UnrealShare
Class HorseFly

source: e:\games\UnrealTournament\UnrealShare\Classes\HorseFly.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--UnrealShare.FlockPawn
            |
            +--UnrealShare.HorseFly
Direct Known Subclasses:None

class HorseFly
extends UnrealShare.FlockPawn

//============================================================================= // HorseFly. // Do not add directly. Rather, add HorseFlySwarms to the world. //=============================================================================
States
Dying, meander

Function Summary
 void Died(Pawn Killer, name damageType, vector HitLocation)
 void EncroachedBy(Actor Other)
 bool EncroachingOn(Actor Other)
     
//==============
// Encroachment
 void PlayTakeHit(float tweentime, vector HitLoc, int damage)


State Dying Function Summary
 void Landed(vector HitNormal)


State meander Function Summary
 void ZoneChange(ZoneInfo NewZone)



Source Code


00001	//=============================================================================
00002	// HorseFly.
00003	// Do not add directly.  Rather, add HorseFlySwarms to the world.
00004	//=============================================================================
00005	class HorseFly extends FlockPawn;
00006	
00007	#exec MESH IMPORT MESH=Firefly ANIVFILE=MODELS\firefl_a.3D DATAFILE=MODELS\firefl_d.3D  LODSTYLE=2
00008	#exec MESH LODPARAMS MESH=FireFly STRENGTH=0.6 
00009	#exec MESH ORIGIN MESH=Firefly X=0 Y=00 Z=0 YAW=64
00010	
00011	#exec MESH SEQUENCE MESH=Firefly SEQ=All    STARTFRAME=0   NUMFRAMES=5
00012	#exec MESH SEQUENCE MESH=Firefly SEQ=Still  STARTFRAME=0   NUMFRAMES=1
00013	#exec MESH SEQUENCE MESH=Firefly SEQ=Flying STARTFRAME=0   NUMFRAMES=4
00014	#exec MESH SEQUENCE MESH=Firefly SEQ=FastFly  STARTFRAME=4   NUMFRAMES=2
00015	
00016	#exec TEXTURE IMPORT NAME=JFirefly1 FILE=MODELS\firefly.PCX GROUP=Skins
00017	#exec MESHMAP SCALE MESHMAP=Firefly X=0.006 Y=0.006 Z=0.012
00018	#exec MESHMAP SETTEXTURE MESHMAP=firefly NUM=1 TEXTURE=Jfirefly1
00019	
00020	#exec AUDIO IMPORT FILE="Sounds\Flies\buzz3.WAV" NAME="flybuzz" GROUP="Flies"
00021	
00022	//-----------------------------------------------------------------------------
00023	// Horsefly variables.
00024	
00025	//==============
00026	// Encroachment
00027	function bool EncroachingOn( actor Other )
00028	{
00029		if ( (Other.Brush != None) || (Brush(Other) != None) )
00030			return true;
00031			
00032		return false;
00033	}
00034	
00035	function EncroachedBy( actor Other )
00036	{
00037	}
00038	
00039	function PlayTakeHit(float tweentime, vector HitLoc, int damage)
00040	{
00041	}
00042	
00043	function Died(pawn Killer, name damageType, vector HitLocation)
00044	{
00045		GotoState('Dying');
00046	}
00047	
00048	auto state meander
00049	{
00050		ignores seeplayer, enemynotvisible, footzonechange;
00051	
00052		singular function ZoneChange( ZoneInfo NewZone )
00053		{
00054			if (NewZone.bWaterZone || NewZone.bPainZone)
00055			{
00056				SetLocation(OldLocation);
00057				Velocity = vect(0,0,0);
00058				Acceleration = vect(0,0,0);
00059				MoveTimer = -1.0;
00060			}
00061		}
00062	
00063		 		
00064	begin:
00065		LoopAnim('Flying');
00066		SetPhysics(PHYS_Flying);
00067	wander:
00068		if ( Owner == None )
00069			Destroy();
00070		if (!LineOfSightTo(Owner))
00071			SetLocation(Owner.Location);
00072	
00073		MoveTo(Owner.Location + HorseflySwarm(Owner).swarmradius * (VRand() +  vect(0,0,0.3)));
00074		if ( Owner == None )
00075			Destroy();
00076		if ( HorseflySwarm(Owner).bOnlyIfEnemy && (Pawn(Owner).Enemy == None) && (FRand() < 0.1) )
00077		{
00078			HorseflySwarm(Owner).swarmsize++;
00079			Destroy();
00080		}
00081		else
00082			Goto('Wander');
00083	}
00084	
00085	State Dying
00086	{
00087		ignores seeplayer, enemynotvisible, footzonechange;
00088	
00089		function Landed(vector HitNormal)
00090		{
00091			SetPhysics(PHYS_None);
00092		}	
00093	
00094	Begin:
00095		if ( Owner != None )
00096		{
00097			HorseflySwarm(Owner).totalflies--;
00098			if ( HorseflySwarm(Owner).totalflies <= 0 )
00099				Owner.Destroy();
00100		}	
00101		SetPhysics(PHYS_Falling);
00102		RemoteRole = ROLE_DumbProxy;
00103		Sleep(15);
00104		Destroy();
00105	}			
00106	
00107	defaultproperties
00108	{
00109	     AirSpeed=200.000000
00110	     Land=None
00111	     AmbientSound=Sound'UnrealShare.flies.flybuzz'
00112	     DrawType=DT_Mesh
00113	     Mesh=LodMesh'UnrealShare.Firefly'
00114	     SoundRadius=7
00115	     SoundVolume=64
00116	     CollisionRadius=0.000000
00117	     CollisionHeight=0.000000
00118	     bCollideActors=False
00119	     bBlockActors=False
00120	     bBlockPlayers=False
00121	     bProjTarget=False
00122	}

End Source Code