XIII
Class OnoFalling

source: C:\XIII\XIII\Classes\OnoFalling.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Effects
         |
         +--XIII.OnoFalling
Direct Known Subclasses:None

class OnoFalling
extends Engine.Effects

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 ATex, HTex
 OnoFalling NextOF
 vector RefLocation
 float fDestroyingtimer
 int index

States
OnoEnding

Function Summary
 void OnoEnd()
     
//_____________________________________________________________________________
 void Tick(float deltatime)
     
//_____________________________________________________________________________


State OnoEnding Function Summary
 void Tick(float deltatime)



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class OnoFalling extends Effects;
00005	
00006	var texture ATex, HTex;
00007	var int index;
00008	var vector RefLocation;
00009	var OnoFalling NextOF;
00010	
00011	var float fDestroyingtimer;
00012	
00013	const SPACEDIST=80.0;
00014	const SIZEDECREASE=0.20;
00015	const SPACEINCREASE=5.0;
00016	
00017	//_____________________________________________________________________________
00018	event PostBeginPlay()
00019	{
00020	    Super.PostBeginPlay();
00021	
00022	    if ( OnoFalling(Owner) != none )
00023	      index = OnoFalling(Owner).index + 1;
00024	
00025	    if (index == 0)
00026	      RefLocation = Owner.Location;
00027	
00028	    if ( Index < 5 )
00029	      Texture = ATex;
00030	    else
00031	      Texture = HTex;
00032	
00033	    SetDrawScale(fmax(0.0,2.0 - (Index - 2)*SIZEDECREASE));
00034	//    Log(self$" PostBeginPlay, index="$Index$" texture="$texture);
00035	}
00036	
00037	//_____________________________________________________________________________
00038	function Tick(float deltatime)
00039	{
00040	    local vector vPos, vDir;
00041	    local float RefDrawScale, RefDist;
00042	
00043	    if ( Index == 0 )
00044	      RefDist = SPACEDIST + 100.0;
00045	    else
00046	      RefDist = SPACEDIST;
00047	    RefDrawScale = 2.0 - (Index - 3)*SIZEDECREASE;
00048	
00049	//    Log(self$" index="$Index$" Location="$Location$" RefDrawScale="$RefDrawScale);
00050	    if ( (NextOF == none) && (RefDrawScale > 0.0) && (vSize(Location - RefLocation) > (RefDist + (Index-5)*SPACEINCREASE)) )
00051	    {
00052	      NextOF = Spawn(class'OnoFalling', self,,RefLocation);
00053	      NextOF.RefLocation = RefLocation;
00054	    }
00055	    vPos = Owner.Location + normal(Location - Owner.Location) * (RefDist + (Index-5)*SPACEINCREASE);
00056	    SetLocation(vPos);
00057	}
00058	
00059	//_____________________________________________________________________________
00060	function OnoEnd()
00061	{
00062	    GotoState('OnoEnding');
00063	    if (NextOF != none)
00064	      NextOF.OnoEnd();
00065	}
00066	
00067	//_____________________________________________________________________________
00068	event Destroyed()
00069	{
00070	    if (NextOF != none)
00071	      NextOF.Destroy();
00072	}
00073	
00074	//_____________________________________________________________________________
00075	state OnoEnding
00076	{
00077	    function Tick(float deltatime)
00078	    {
00079	      local vector vPos, vDir;
00080	      local float RefDrawScale, RefDist;
00081	
00082	      fDestroyingtimer += Deltatime*10.0;
00083	      if ( Index == 0 )
00084	        RefDist = SPACEDIST + 100.0;
00085	      else
00086	        RefDist = SPACEDIST;
00087	      RefDrawScale = 2.0 - (Index - 3 + fDestroyingtimer)*SIZEDECREASE;
00088	
00089	      if ( RefDrawScale < 0.0 )
00090	        destroy();
00091	      else
00092	        SetDrawScale(RefDrawScale);
00093	      vPos = Owner.Location + normal(Location - Owner.Location) * (RefDist + (Index-5)*SPACEINCREASE);
00094	      SetLocation(vPos);
00095	    }
00096	}
00097	
00098	
00099	
00100	defaultproperties
00101	{
00102	     ATex=Texture'XIIIMenu.SFX.ALetterM'
00103	     HTex=Texture'XIIIMenu.SFX.HLetterM'
00104	     DrawScale=2.000000
00105	}

End Source Code