## XIDCine
Class ScriptedLight

source: C:\XIII\XIDCine\Classes\ScriptedLight.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Light
             |
             +--XIDCine.ScriptedLight

Direct Known Subclasses:None

class ScriptedLight
extends Engine.Light

    //=============================================================================
    // ScriptedLight.
    // A lightsource which can be triggered on or off using a complex script.
    //=============================================================================

Variables
`name` | `CurrentState` Initial brightness.
`float` | `InitialBrightness` Initial brightness.
`ELightType` | `LightType` Initial brightness.
`Actor` | `SavedTrigger` Initial brightness.
`int` | `Time` Initial brightness.
`array` | `TurnOffScript` Initial brightness.
`array` | `TurnOnScript` Initial brightness.
`bool` | `bInitiallyOn` Whether it's initially on.
`bool` | `bOnOff` Initial brightness.
`int` | `index` Initial brightness.

Function Summary
`simulated` | `BeginPlay()`
    // Called at start of gameplay.
`void` | `Trigger(Actor Other, Pawn EventInstigator)`
    /*	EVENT BeginState()
    	{
    		DebugLog("ScriptedLight::TriggerToggle::BeginState");
    		enable('Trigger');
    	}
    */

Source Code

    00001	//=============================================================================
    00002	// ScriptedLight.
    00003	// A lightsource which can be triggered on or off using a complex script.
    00004	//=============================================================================
    00005	class ScriptedLight extends Light;
    00006
    00007	//-----------------------------------------------------------------------------
    00008	// Variables.
    00009
    00010	var() bool  bInitiallyOn;      // Whether it's initially on.
    00011
    00012	var   float InitialBrightness; // Initial brightness.
    00013	var   actor SavedTrigger;
    00014	var int index;
    00015	struct SLightScript
    00016	{
    00017	    var() ELightType    LightType;
    00018	    var() int           Time;
    00019	};
    00020
    00021	var() array<SLightScript> TurnOnScript;
    00022	var() array<SLightScript> TurnOffScript;
    00023	var name    CurrentState;
    00024	var bool    bOnOff;
    00025
    00026	//-----------------------------------------------------------------------------
    00027	// Engine functions.
    00028
    00029	// Called at start of gameplay.
    00030	simulated function BeginPlay()
    00031	{
    00032	    InitialBrightness = LightBrightness;
    00033	    bOnOff = bInitiallyOn;
    00034	    if (!bOnOff)
    00035	      LightBrightness=0;
    00036	    SetDrawType(DT_None);
    00037	}
    00038
    00039	// Trigger toggles the light.
    00040	state() TriggerToggle
    00041	{
    00042	/*	EVENT BeginState()
    00043		{
    00044			DebugLog("ScriptedLight::TriggerToggle::BeginState");
    00045			enable('Trigger');
    00046		}
    00047	*/
    00048		FUNCTION Trigger( actor Other, pawn EventInstigator )
    00049		{
    00050			DebugLog("ScriptedLight::TriggerToggle::Trigger");
    00051			if( SavedTrigger!=None )
    00052				SavedTrigger.EndEvent();
    00053			SavedTrigger = Other;
    00054			SavedTrigger.BeginEvent();
    00055			bOnOff=!bOnOff;
    00056			if (bOnOff)
    00057				GotoState( 'TriggerToggle', 'TurnOff' );
    00058			else
    00059				GotoState( 'TriggerToggle', 'TurnOn' );
    00060		}
    00061	TurnOn:
    00062		DebugLog("ScriptedLight::PlayTurnOnScript::Begin");
    00063		LightBrightness = InitialBrightness;
    00064	  RefreshLighting();
    00065		index=0;
    00066		while (index<TurnOnScript.Length)
    00067		{
    00068			DebugLog("ScriptedLight::PlayTurnOnScript::in loop");
    00069	//		LightType=TurnOnScript[index].LightType;
    00070			Sleep(TurnOnScript[index].Time);
    00071			++index;
    00072		}
    00073		stop;
    00074
    00075	TurnOff:
    00076		DebugLog("ScriptedLight::PlayTurnOffScript::Begin");
    00077	  index=0;
    00078	  while (index<TurnOffScript.Length)
    00079	  {
    00080			DebugLog("ScriptedLight::PlayTurnOffScript::in loop");
    00081	//        LightType=TurnOffScript[index].LightType;
    00082	    Sleep(TurnOffScript[index].Time);
    00083	    ++index;
    00084	  }
    00085	  LightBrightness = 0;
    00086	  RefreshLighting();
    00087		stop;
    00088	}
    00089
    00090	//	bNoDelete=false
    00091
    00092
    00093
    00094	defaultproperties
    00095	{
    00096	     bStatic=False
    00097	     bHidden=False
    00098	     bNoDelete=False
    00099	     bDynamicLight=True
    00100	     bMovable=True
    00101	     RemoteRole=ROLE_SimulatedProxy
    00102	     InitialState="TriggerToggle"
    00103	}

End Source Code