XIDCine
Class CineTrigger

source: C:\XIII\XIDCine\Classes\CineTrigger.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Triggers
         |
         +--Engine.Trigger
            |
            +--XIDCine.CineTrigger
Direct Known Subclasses:None

class CineTrigger
extends Engine.Trigger

//============================================================================= // CineTrigger. // Created by iKi // Last Modification by iKi //=============================================================================
Variables
 Pawn BufferredEventInstigator
 Actor BufferredOther
 int Count
 float TimeStamp


Function Summary
 void CineEvent(string Cine2Label)



Source Code


00001	//=============================================================================
00002	// CineTrigger.
00003	// Created by iKi
00004	// Last Modification by iKi
00005	//=============================================================================
00006	class CineTrigger extends Trigger
00007		HideCategories(force,lightcolor,lighting,rollof,sound);
00008	
00009	#exec Texture Import File=Textures\Cine_ico.pcx Name=Cine_ico Mips=Off
00010	
00011	VAR(CounterTrigger)	int InitialCounterValue;
00012	VAR TRANSIENT int Count;
00013	VAR(BufferTrigger)	float Period;
00014	VAR(BufferTrigger)	float MaxDelay;
00015	
00016	VAR TRANSIENT float TimeStamp;
00017	VAR TRANSIENT Actor BufferredOther;
00018	VAR TRANSIENT Pawn BufferredEventInstigator;
00019	
00020	FUNCTION CineEvent(string Cine2Label)
00021	{
00022		LOCAL CineController2 cc;
00023	
00024		if ( !( Cine2Label~="none" ) && (Cine2Label!="") )
00025		{
00026			foreach DynamicActors(class'CineController2', cc)
00027			{
00028				cc.CineGoto( Cine2Label );
00029			}
00030		}
00031	}
00032	
00033	EVENT Trigger( actor a, pawn p)
00034	{
00035		CineEvent( string( tag ) );
00036	}
00037	
00038	STATE() CounterTrigger
00039	{
00040		EVENT BeginState( )
00041		{
00042			Count = InitialCounterValue;
00043			SetCollision( false, false, false );
00044			bCollideWorld=false;
00045		}
00046	
00047		EVENT Trigger( actor a, pawn p )
00048		{
00049			Count--;
00050			if ( !bool( Count ) )
00051			{
00052				TriggerEvent( event, self, instigator);
00053				if ( bTriggerOnceOnly )
00054					Destroy( );
00055				else
00056					Count = InitialCounterValue;
00057			}
00058		}
00059	}
00060	
00061	// repeat the event until at least one actor catch it
00062	STATE() BufferTrigger
00063	{
00064		EVENT BeginState()
00065		{
00066			Period = FMax( 0.016, Period );
00067			SetCollision( false, false, false );
00068			bCollideWorld=false;
00069		}
00070	
00071		EVENT Timer( )
00072		{
00073			TimeStamp += Period;
00074			if ( ( MaxDelay == 0) || ( TimeStamp <= MaxDelay ) )
00075			{
00076				Trigger( BufferredOther, BufferredEventInstigator );
00077			}
00078		}
00079	
00080		EVENT Trigger( Actor Other, Pawn EventInstigator )
00081		{
00082			LOCAL bool b;
00083			LOCAL Actor A;
00084	
00085			b = false;
00086			ForEach DynamicActors( class 'Actor', A, Event )
00087			{
00088				if (A!=self)
00089				{
00090					log( self@"BUFFERED TRIGGER CATCH BY"@A );
00091					A.Trigger( Other, EventInstigator );
00092					b = b || (!A.IsA('TriggerSound'));
00093				}
00094			}
00095			if (b)
00096			{
00097				if ( bTriggerOnceOnly )
00098					Destroy( );
00099			}
00100			else
00101			{
00102				BufferredOther = Other;
00103				BufferredEventInstigator = EventInstigator;
00104				SetTimer( Period , false );
00105			}
00106		}
00107	}
00108	
00109	STATE() ControlledSoldierTouchTrigger
00110	{
00111		EVENT Trigger( actor Other, pawn EventInstigator )
00112		{
00113			LOG( "ControlledSoldierTouchTrigger TRIGGER"@other );
00114			bInitiallyActive = true;
00115			CheckTouchList();
00116		}
00117	
00118		EVENT UnTrigger( actor Other, pawn EventInstigator )
00119		{
00120			LOG( "ControlledSoldierTouchTrigger UNTRIGGER"@other );
00121			bInitiallyActive = false;
00122		}
00123	
00124		EVENT Touch( Actor Other )
00125		{
00126			LOG( "ControlledSoldierTouchTrigger TOUCH"@other );
00127	
00128			if ( bInitiallyActive && Other.IsA('BaseSoldier') )
00129			{
00130				instigator = pawn(other);
00131				TriggerEvent( event, self, Instigator );
00132			}
00133		}
00134	}
00135	
00136	STATE() PlayerTouchControlTrigger
00137	{
00138		EVENT Touch( Actor Other )
00139		{
00140			LOG( "PlayerTouchControlTrigger TOUCH"@other );
00141			if ( other.IsA('XIIIPlayerPawn') )
00142			{
00143				instigator = pawn(other);
00144				TriggerEvent( event, self, Instigator );
00145			}
00146		}
00147	
00148		EVENT UnTouch( Actor Other )
00149		{
00150			LOG( "PlayerTouchControlTrigger UNTOUCH"@other );
00151			if ( other.IsA('XIIIPlayerPawn') )
00152			{
00153				instigator = pawn(other);
00154				UnTriggerEvent( event, self, Instigator );
00155			}
00156		}
00157	
00158		EVENT Trigger( Actor Other, Pawn EventInstigator )
00159		{
00160		}
00161	}
00162	
00163	
00164	
00165	defaultproperties
00166	{
00167	     InitialCounterValue=1
00168	     Period=1.000000
00169	     bTriggerOnceOnly=True
00170	     Texture=Texture'XIDCine.Cine_ico'
00171	}

End Source Code