Botpack
Class PlasmaSphere

source: e:\games\UnrealTournament\Botpack\Classes\PlasmaSphere.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Projectile
         |
         +--Botpack.PlasmaSphere
Direct Known Subclasses:None

class PlasmaSphere
extends Engine.Projectile

//============================================================================= // PlasmaSphere. //=============================================================================
Variables
 Float AnimTime
 Sound EffectSound1
 Texture ExpType
 int NumFrames
 Texture SpriteAnim[20]
 bExplosionEffect, bHitPawn

States
Flying

Function Summary
 void BlowUp(vector HitLocation)
 
simulated
Explode(vector HitLocation, vector HitNormal)
 
simulated
PostBeginPlay()
 
simulated
ProcessTouch(Actor Other, vector HitLocation)
 
simulated
TakeDamage(int NDamage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
 
simulated
Timer()


State Flying Function Summary



Source Code


00001	//=============================================================================
00002	// PlasmaSphere.
00003	//=============================================================================
00004	class PlasmaSphere extends Projectile;
00005	
00006	#exec OBJ LOAD FILE=textures\PlasmaExplo.utx PACKAGE=Botpack.PlasmaExplo
00007	 
00008	#exec AUDIO IMPORT FILE="..\unrealshare\Sounds\Dispersion\DFly1.WAV" NAME="PulseFly" GROUP="PulseGun"
00009	#exec AUDIO IMPORT FILE="Sounds\Pulsegun\PulseExp.WAV" NAME="PulseExp" GROUP="PulseGun"
00010	
00011	var bool bExploded, bExplosionEffect, bHitPawn;
00012	var() texture ExpType;
00013	var() Sound EffectSound1;
00014	var() texture SpriteAnim[20];
00015	var() int NumFrames;
00016	var Float AnimTime;
00017	
00018	simulated function PostBeginPlay()
00019	{
00020		Super.PostBeginPlay();
00021		SetTimer(0.8, true);
00022		if ( Level.NetMode == NM_Client )
00023			LifeSpan = 2.0;
00024		else
00025			Velocity = Speed * vector(Rotation);
00026		if ( Level.bDropDetail )
00027			LightType = LT_None;
00028	}
00029	
00030	simulated function Timer()
00031	{
00032		if ( Level.bDropDetail )
00033			LightType = LT_None;
00034		if ( (Physics == PHYS_None) && (LifeSpan > 0.5) )
00035			LifeSpan = 0.5;
00036	}
00037	
00038	simulated function TakeDamage( int NDamage, Pawn instigatedBy, Vector hitlocation, 
00039						Vector momentum, name damageType)
00040	{
00041		bExploded = True;
00042	}
00043	
00044	function BlowUp(vector HitLocation)
00045	{
00046		PlaySound(EffectSound1,,7.0);	
00047	}
00048	
00049	simulated function Explode(vector HitLocation, vector HitNormal)
00050	{
00051		if ( !bExplosionEffect )
00052		{
00053			if ( Role == ROLE_Authority )
00054				BlowUp(HitLocation);
00055			bExplosionEffect = true;
00056			if ( !Level.bHighDetailMode || bHitPawn || Level.bDropDetail )
00057			{
00058				if ( bExploded )
00059				{
00060					Destroy();
00061					return;
00062				}
00063				else
00064					DrawScale = 0.45;
00065			}
00066			else
00067				DrawScale = 0.65;
00068	
00069		    LightType = LT_Steady;
00070			LightRadius = 5;
00071			SetCollision(false,false,false);
00072			LifeSpan = 0.5;
00073			Texture = ExpType;
00074			DrawType = DT_SpriteAnimOnce;
00075			Style = STY_Translucent;
00076			if ( Region.Zone.bMoveProjectiles && (Region.Zone.ZoneVelocity != vect(0,0,0)) )
00077			{
00078				bBounce = true;
00079				Velocity = Region.Zone.ZoneVelocity;
00080			}
00081			else
00082				SetPhysics(PHYS_None);
00083		}
00084	}
00085	
00086	simulated function ProcessTouch (Actor Other, vector HitLocation)
00087	{
00088		If ( Other!=Instigator  && PlasmaSphere(Other)==None )
00089		{
00090			if ( Other.bIsPawn )
00091			{
00092				bHitPawn = true;
00093				bExploded = !Level.bHighDetailMode || Level.bDropDetail;
00094			}
00095			if ( Role == ROLE_Authority )
00096				Other.TakeDamage( Damage, instigator, HitLocation, MomentumTransfer*Vector(Rotation), MyDamageType);	
00097			Explode(HitLocation, vect(0,0,1));
00098		}
00099	}
00100	
00101	auto State Flying
00102	{
00103	Begin:
00104		LifeSpan = 2.0;
00105	}
00106	
00107	defaultproperties
00108	{
00109	     ExpType=Texture'Botpack.PlasmaExplo.pblst_a00'
00110	     EffectSound1=Sound'Botpack.PulseGun.PulseExp'
00111	     NumFrames=11
00112	     speed=1450.000000
00113	     Damage=20.000000
00114	     MomentumTransfer=10000
00115	     MyDamageType=Pulsed
00116	     ExploWallOut=10.000000
00117	     ExplosionDecal=Class'Botpack.BoltScorch'
00118	     RemoteRole=ROLE_SimulatedProxy
00119	     LifeSpan=0.500000
00120	     DrawType=DT_Sprite
00121	     Style=STY_Translucent
00122	     Texture=Texture'Botpack.PlasmaExplo.pblst_a00'
00123	     DrawScale=0.190000
00124	     AmbientGlow=187
00125	     bUnlit=True
00126	     SoundRadius=10
00127	     SoundVolume=218
00128	     LightType=LT_Steady
00129	     LightEffect=LE_NonIncidence
00130	     LightBrightness=255
00131	     LightHue=83
00132	     LightRadius=3
00133	     bFixedRotationDir=True
00134	}

End Source Code