RuneI
Class Bird

source: c:\runehov\RuneI\Classes\Bird.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--RuneI.ScriptPawn
            |
            +--RuneI.Bird
Direct Known Subclasses:Crow, SeaBird

class Bird
extends RuneI.ScriptPawn

//============================================================================= // Bird. //=============================================================================
Variables
 float Angle
 float CircleRadius

States
Dying, Fleeing

Function Summary
 void CheckForEnemies()
 bool JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Momentum, name DamageType, int joint)
 Texture PainSkin(int BodyPart)
 void PlayMoving(optional float)
 void PlayWaiting(optional float)
     
// ANIMATIONS -----------------------------------------------------------------
 void PreBeginPlay()
     
// FUNCTIONS ------------------------------------------------------------------
 void PreSetMovement()


State Dying Function Summary
 void Trigger(Actor other, Pawn eventInstigator)
     
//------------------------------------------------------------
//
// STATE LoneFlyer
//
// Used to script a bird flying on a particular path
//------------------------------------------------------------
 void ReplaceWithCarcass()
     
//	function Landed(vector HitNormal)
//	{
//	}
 void BeginState()


State Fleeing Function Summary
 void ZoneChange(ZoneInfo NewZone)
 void PickDestination()
 void HitWall(vector HitNormal, Actor Wall)



Source Code


00001	//=============================================================================
00002	// Bird.
00003	//=============================================================================
00004	class Bird expands ScriptPawn;
00005	
00006	
00007	var() float CircleRadius;
00008	
00009	var	vector CircleCenter;
00010	var float Angle;
00011	
00012	// FUNCTIONS ------------------------------------------------------------------
00013	
00014	function PreBeginPlay()
00015	{
00016		Super.PreBeginPlay();
00017		CircleCenter = Location;
00018	}
00019	
00020	function PreSetMovement()
00021	{
00022		bCanJump = false;
00023		bCanWalk = false;
00024		bCanSwim = false;
00025		bCanFly = true;
00026		MinHitWall = -0.6;
00027		bCanOpenDoors = false;
00028		bCanDoSpecial = false;
00029	}
00030	
00031	function CheckForEnemies()
00032	{
00033	}
00034	
00035	function Texture PainSkin(int BodyPart)
00036	{
00037		return None;
00038	}
00039	
00040	// ANIMATIONS -----------------------------------------------------------------
00041	function PlayWaiting(optional float tween)			{	LoopAnim('idle', 1.0, 0.1);	}
00042	function PlayMoving(optional float tween)			{	LoopAnim('fly', 1.0, 0.1);	}
00043	
00044	function bool JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Momentum, name DamageType, int joint)
00045	{	// Force death
00046		return Super.JointDamaged(Damage, EventInstigator, HitLoc, Momentum, DamageType, joint);
00047	}
00048	
00049	
00050	// STATES ---------------------------------------------------------------------
00051	
00052	State Fleeing
00053	{
00054	ignores SeePlayer, HearNoise, EnemyAcquired;
00055	
00056		function HitWall(vector HitNormal, actor Wall)
00057		{	// avoid cowering
00058			global.HitWall(HitNormal, Wall);
00059		}
00060	
00061		function PickDestination()
00062		{
00063			Destination = Location + VRand()*50;
00064		}
00065	
00066	Move:
00067		PickDestination();
00068		MoveTo(Destination, MovementSpeed);
00069		Goto('Move');
00070	}
00071	
00072	
00073	state() Circle
00074	{
00075		ignores seeplayer, hearnoise, enemynotvisible;
00076	
00077		singular function ZoneChange( ZoneInfo NewZone )
00078		{
00079			if (NewZone.bWaterZone || NewZone.bPainZone)
00080			{
00081				SetLocation(OldLocation);
00082				Velocity = vect(0,0,0);
00083				Acceleration = vect(0,0,0);
00084				MoveTimer = -1.0;
00085			}
00086		}
00087	
00088	begin:
00089		PlayMoving(0.1);
00090	
00091	Move:
00092		Angle += 1.0484; //2*3.1415/6;
00093		Destination.X = CircleCenter.X - CircleRadius * Sin(Angle);
00094		Destination.Y = CircleCenter.Y + CircleRadius * Cos(Angle);
00095		Destination.Z = CircleCenter.Z + 30 * FRand() - 15;
00096		MoveTo(Destination, MovementSpeed);
00097		Goto('Move');
00098	}
00099	
00100	
00101	//------------------------------------------------------------
00102	//
00103	// STATE Dying
00104	//
00105	//------------------------------------------------------------
00106	state Dying
00107	{
00108	ignores SeePlayer, EnemyNotVisible, HearNoise, KilledBy, Trigger, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, WarnTarget, Died, LongFall, PainTimer, Landed;
00109	
00110		function BeginState()
00111		{
00112			SetPhysics(PHYS_Falling);
00113			Super.BeginState();
00114		}
00115	
00116	//	function Landed(vector HitNormal)
00117	//	{
00118	//	}
00119		function ReplaceWithCarcass()
00120		{
00121			SpawnBodyGibs(Velocity);
00122		}
00123	
00124	PostDeath:
00125		// spawn blood spot
00126		Destroy();
00127	}
00128	
00129	//------------------------------------------------------------
00130	//
00131	// STATE LoneFlyer
00132	//
00133	// Used to script a bird flying on a particular path
00134	//------------------------------------------------------------
00135	
00136	state() LoneFlyer
00137	{
00138	ignores SeePlayer, EnemyNotVisible, HearNoise, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, WarnTarget, LongFall, PainTimer, Landed;
00139	
00140		function Trigger(actor other, pawn eventInstigator)
00141		{
00142			local InterpolationPoint i;
00143	
00144			if(Event != 'None')
00145				foreach AllActors(class 'InterpolationPoint', i, Event)
00146					if(i.Position == 0)
00147					{ // Found a matching path
00148						SetCollision(true, false, false);
00149						bCollideWorld = False;
00150						Target = i;
00151						SetPhysics(PHYS_Interpolating);
00152						PhysRate = 1.0;
00153						PhysAlpha = 0.0;
00154						bInterpolating = true;
00155						return;
00156					}
00157		}
00158	
00159	begin:
00160		LoopAnim('fly', 1.0, 0.1);
00161	}
00162	
00163	defaultproperties
00164	{
00165	     CircleRadius=70.000000
00166	     FightOrDefend=1.000000
00167	     HighOrLow=1.000000
00168	     bRoamHome=True
00169	     bGlider=True
00170	     GroundSpeed=0.000000
00171	     WaterSpeed=5.000000
00172	     AirSpeed=300.000000
00173	     AccelRate=400.000000
00174	     JumpZ=0.000000
00175	     WalkingSpeed=300.000000
00176	     ClassID=11
00177	     Health=10
00178	     CollisionRadius=25.000000
00179	     CollisionHeight=12.000000
00180	     bBlockActors=False
00181	     bBlockPlayers=False
00182	     Mass=50.000000
00183	     Buoyancy=100.000000
00184	     RotationRate=(Yaw=22768)
00185	}

End Source Code