XIII
Class MuzzleFlashAttachment

source: C:\XIII\XIII\Classes\MuzzleFlashAttachment.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.InventoryAttachment
         |
         +--XIII.MuzzleFlashAttachment
Direct Known Subclasses:MFKalashAttach, MFLargeAttach, MFM16Attach, MFM60Attach, MFMediumAttach, MFShotGun, MFSmallAttach, MFXLargeAttach

class MuzzleFlashAttachment
extends Engine.InventoryAttachment

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 MuzzleLight MFLight
           How long to display it
 EDrawType MemDrawType
           How long to display it
 int TickCount
           How long to display it

States
Location, DT, Visible

Function Summary
 
simulated
Flash()
     
//_____________________________________________________________________________


State Location Function Summary


State DT Function Summary


State Visible Function Summary



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class MuzzleFlashAttachment extends InventoryAttachment;
00005	
00006	var int TickCount;     // How long to display it
00007	
00008	var(MuzzleFlash) bool bUseRandRotation;
00009	var EDrawType MemDrawType;
00010	var MuzzleLight MFLight;
00011	
00012	//_____________________________________________________________________________
00013	simulated event PostBeginPlay()
00014	{
00015	    DebugLog("FLASH"@self@"SPAWN Owner="$Owner);
00016	    MemDrawType = DrawType;
00017	    SetDrawType(DT_None);
00018	    MFLight = Spawn(class'MuzzleLight',self,,Location);
00019	}
00020	
00021	//_____________________________________________________________________________
00022	simulated event Timer()
00023	{
00024	    SetDrawType(DT_None);
00025	}
00026	
00027	//_____________________________________________________________________________
00028	simulated function Flash()
00029	{
00030	    DebugLog("   FLASHED"@self);
00031	    GotoState('Visible');
00032	}
00033	
00034	//_____________________________________________________________________________
00035	simulated state Visible
00036	{
00037	    simulated event Tick(float Delta)
00038	    {
00039	      if ( (DrawType==DT_None) && (TickCount > 3) )
00040	      {
00041	        MFLight.Flash(Instigator.Location + Instigator.EyePosition() + vector(Instigator.GetViewRotation())*70);
00042	        SetDrawType(MemDrawType);
00043	        DebugLog("   - FLASH"@self@"Tick SetDrawType"@DrawType);
00044	      }
00045	      else
00046	        DebugLog("   - FLASH"@self@"Tick DT("$DrawType$")");
00047	      if (TickCount>5)
00048	        gotoState('');
00049	      TickCount++;
00050	    }
00051	
00052	    simulated function EndState()
00053	    {
00054	      DebugLog("   FLASH"@self@"EndState DT("$DrawType$")");
00055	      SetDrawType(DT_None);
00056	    }
00057	
00058	    simulated function BeginState()
00059	    {
00060	      local Rotator R;
00061	      local vector V;
00062	
00063	      DebugLog("   FLASH"@self@"BeginState Location"@Location);
00064	      TickCount=0;
00065	
00066	      R = RelativeRotation;
00067	      if ( bUseRandRotation )
00068	        R.Roll = Rand(65535);
00069	      SetRelativeRotation(R);
00070	
00071	      V=Default.DrawScale3D;
00072	      V.X += frand() - 0.5;
00073	      V.Y += frand() - 0.5;
00074	
00075	      SetDrawScale3D(v);
00076	    }
00077	}
00078	
00079	simulated event Destroyed()
00080	{
00081	    DebugLog("FLASH"@self@"DESTROY");
00082	    Super.Destroyed();
00083	    MFLight.Destroy();
00084	}
00085	
00086	
00087	
00088	defaultproperties
00089	{
00090	     bUseRandRotation=True
00091	     bAcceptsProjectors=False
00092	     bTearOff=True
00093	     bUnlit=True
00094	     RemoteRole=ROLE_None
00095	}

End Source Code