## XIII
Class LaserTrigger

source: C:\XIII\XIII\Classes\LaserTrigger.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Triggers
             |
             +--XIII.XIIITriggers
                |
                +--XIII.LaserTrigger

Direct Known Subclasses:None

class LaserTrigger
extends XIII.XIIITriggers

    //-----------------------------------------------------------
    //
    //-----------------------------------------------------------

Variables
`LaserEmmiter2,` | `BlueBallAmitter`
`XIIIPlayerPawn` | `PawnIn`
`SNDIndex1,` | `SNDIndex2`
`bool` | `bOn`
`float` | `fFrequency`
`sound` | `hSoundOff`
`sound` | `hSoundOn`

States
On

Function Summary
`void` | `PostBeginPlay()`
    //_____________________________________________________________________________

State On Function Summary
`void` | `tick(float DT)`
    /*
`void` | `BeginState()`

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class LaserTrigger extends XIIITriggers;
    00005
    00006	var bool bOn;
    00007	var() float fFrequency;
    00008	var XIIIPlayerPawn PawnIn;
    00009	var() Emitter LaserEmmiter1, LaserEmmiter2, BlueBallAmitter;
    00010	var int SNDIndex1, SNDIndex2;
    00011
    00012	var sound hSoundOn;
    00013	var sound hSoundOff;
    00014
    00015	//_____________________________________________________________________________
    00016	function PostBeginPlay()
    00017	{
    00018	    local LaserTrigger LT;
    00019
    00020	    foreach allactors(class'LaserTrigger', LT)
    00021	    {
    00022	      if (LT != none)
    00023	      {
    00024	        if ( LT.SNDIndex1 == 1 )
    00025	        {
    00026	          SNDIndex1 = 3;
    00027	          SNDIndex2 = 4;
    00028	        }
    00029	        else
    00030	        {
    00031	          SNDIndex1 = 1;
    00032	          SNDIndex2 = 2;
    00033	        }
    00034	        break;
    00035	      }
    00036	    }
    00037	//    Log("~~~ Init for"@self@" SNDIndex1="$SNDIndex1@"SNDIndex2="$SNDIndex2@"hSoundOn="$hSoundOn@"hSoundOff="$hSoundOff);
    00038	}
    00039
    00040	//_____________________________________________________________________________
    00041	auto state On
    00042	{
    00043	    function BeginState()
    00044	    {
    00045	      SetTimer(fFrequency, true);
    00046	    }
    00047
    00048	    event Timer()
    00049	    {
    00050	      bOn = !bOn;
    00051	      if ( bOn && (PawnIn != none) && !PawnIn.bIsDead )
    00052	      {
    00053	//        Log("Ending Game because PawnIn '"$PawnIn$"' in LaserTrigger ");
    00054	        Level.Game.EndGame( PlayerController(PawnIn.Controller).PlayerReplicationInfo, "PlayerKilled" );
    00055	        Gotostate('');
    00056	      }
    00057	      LaserEmmiter1.Emitters[0].Disabled = !bOn;
    00058	      LaserEmmiter2.Emitters[0].Disabled = !bOn;
    00059	      if ( BlueBallAmitter != none )
    00060	        BlueBallAmitter.Emitters[0].Disabled = !bOn;
    00061	      if ( bOn )
    00062	      {
    00063	//        Log("~~~ Playing sounds hSoundOn="$hSoundOn);
    00064	        LaserEmmiter1.PlaySound(hSoundOn, SNDIndex1);
    00065	        LaserEmmiter2.PlaySound(hSoundOn, SNDIndex2);
    00066	      }
    00067	      else
    00068	      {
    00069	//        Log("~~~ Playing sounds hSoundOff="$hSoundOff);
    00070	        LaserEmmiter1.PlaySound(hSoundOff, SNDIndex1);
    00071	        LaserEmmiter2.PlaySound(hSoundOff, SNDIndex2);
    00072	      }
    00073	//      Log("Laser "$self$" "$bOn);
    00074	    }
    00075
    00076	    event Touch( Actor Other )
    00077	    {
    00078	//      Log("Laser "$self$" Touched by "$Other$" in state "$bOn);
    00079	      if ( (XIIIPawn(Other) != none) && XIIIPawn(Other).IsPlayerPawn() && !XIIIPawn(Other).bIsDead )
    00080	      {
    00081	        PawnIn = XIIIPlayerPawn(Other);
    00082	        if ( bOn )
    00083	        {
    00084	          Level.Game.EndGame( PlayerController(PawnIn.Controller).PlayerReplicationInfo, "PlayerKilled" );
    00085	          Gotostate('');
    00086	        }
    00087	      }
    00088	    }
    00089	    event UnTouch( Actor Other )
    00090	    {
    00091	//      Log("Laser "$self$" UnTouched by "$Other$" in state "$bOn);
    00092	      PawnIn = none;
    00093	    }
    00094
    00095	/*    function tick(float DT)
    00096	    {
    00097	        local actor A;
    00098
    00099	        foreach touchingactors(class'actor', A)
    00100	          if (A != none)
    00101	            Log(self@"touching"@A);
    00102	    }*/
    00103	}
    00104
    00105
    00106
    00107	defaultproperties
    00108	{
    00109	     bOn=True
    00110	     fFrequency=4.000000
    00111	     hSoundOn=Sound'XIIIsound.Ambient__Hual2Laser.Hual2Laser__hLaserOn'
    00112	     hSoundOff=Sound'XIIIsound.Ambient__Hual2Laser.Hual2Laser__hLaserOff'
    00113	     CollisionRadius=210.000000
    00114	}

End Source Code