Botpack
Class UT_WallHit

source: e:\games\UnrealTournament\Botpack\Classes\UT_WallHit.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Effects
         |
         +--Botpack.BulletImpact
            |
            +--Botpack.UT_WallHit
Direct Known Subclasses:ImpactMark, SawHit, UT_HeavyWallHitEffect, UT_LightWallHitEffect

class UT_WallHit
extends Botpack.BulletImpact

//============================================================================= // UT_WallHit. //=============================================================================
Variables
 float ChipOdds
 MaxChips, MaxSparks
 rotator RealRotation

States
StartUp

Function Summary
 
simulated
SpawnEffects()
 
simulated
SpawnSound()


State StartUp Function Summary



Source Code


00001	//=============================================================================
00002	// UT_WallHit.
00003	//=============================================================================
00004	class UT_WallHit extends BulletImpact;
00005	
00006	var int MaxChips, MaxSparks;
00007	var float ChipOdds;
00008	var rotator RealRotation;
00009	
00010	replication
00011	{
00012		// Things the server should send to the client.
00013		unreliable if( Role==ROLE_Authority )
00014			RealRotation;
00015	}
00016	
00017	simulated function SpawnSound()
00018	{
00019		local float decision;
00020	
00021		decision = FRand();
00022		if ( decision < 0.25 ) 
00023			PlaySound(sound'ricochet',, 1.5,,1200, 0.5+FRand());		
00024		else if ( decision < 0.5 )
00025			PlaySound(sound'Impact1',, 2.5,,1000);
00026		else if ( decision < 0.75 )
00027			PlaySound(sound'Impact2',, 2.5,,1000);
00028	}
00029	
00030	simulated function SpawnEffects()
00031	{
00032		local Actor A;
00033		local int j;
00034		local int NumSparks;
00035	
00036		SpawnSound();
00037	
00038		NumSparks = rand(MaxSparks);
00039		if ( !Level.bDropDetail )
00040			for ( j=0; j<MaxChips; j++ )
00041				if ( FRand() < ChipOdds ) 
00042				{
00043					NumSparks--;
00044					A = spawn(class'Chip');
00045					if ( A != None )
00046						A.RemoteRole = ROLE_None;
00047				}
00048	
00049		if ( !Level.bHighDetailMode )
00050			return;
00051	
00052		Spawn(class'Pock');
00053		if ( Level.bDropDetail )
00054			return;
00055	
00056		A = Spawn(class'UT_SpriteSmokePuff');
00057		A.RemoteRole = ROLE_None;
00058		if ( !Region.Zone.bWaterZone && (NumSparks > 0) ) 
00059			for (j=0; j<NumSparks; j++) 
00060				spawn(class'UT_Spark',,,Location + 8 * Vector(Rotation));
00061	}
00062	
00063	Auto State StartUp
00064	{
00065		simulated function Tick(float DeltaTime)
00066		{
00067			if ( Instigator != None )
00068				MakeNoise(0.3);
00069			if ( Role == ROLE_Authority )
00070				RealRotation = Rotation;
00071			else
00072				SetRotation(RealRotation);
00073			
00074			if ( Level.NetMode != NM_DedicatedServer )
00075				SpawnEffects();
00076			Disable('Tick');
00077		}
00078	}
00079	
00080	defaultproperties
00081	{
00082	     MaxChips=2
00083	     MaxSparks=3
00084	     ChipOdds=0.200000
00085	     bNetOptional=True
00086	     RemoteRole=ROLE_SimulatedProxy
00087	}

End Source Code