## XIII
Class XIIIBirds

source: C:\XIII\XIII\Classes\XIIIBirds.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Controller
             |
             +--Engine.AIController
                |
                +--XIII.XIIITransientACreature
                   |
                   +--XIII.XIIIBirds

Direct Known Subclasses:Mouettes

class XIIIBirds
extends XIII.XIIITransientACreature

    //-----------------------------------------------------------
    //
    //-----------------------------------------------------------

Variables
`int` | `MaxFlockSize` number of slave birds
`int` | `MinFlockSize` number of slave birds
`int` | `fSecurityDist` number of slave birds

States
Wandering

Function Summary
`void` | `PostBeginPlay()`
    //_____________________________________________________________________________

State Wandering Function Summary
`void` | `BeginState()`
`void` | `PickSlaveDestination(XIIITransientAPawn P)`
`vector` | `PickDestination(XIIITransientAPawn P)`

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class XIIIBirds extends XIIITransientACreature;
    00005
    00006	var int MinFlockSize;     // number of slave birds
    00007	var int MaxFlockSize;
    00008	var int fSecurityDist;
    00009
    00010	//_____________________________________________________________________________
    00011	function PostBeginPlay()
    00012	{
    00013	    Super.PostBeginPlay();
    00014	    if ( Pawn == None )
    00015	      return;
    00016	    NumSlaves = MinFlockSize + Rand(MaxFlockSize-MinFlockSize);
    00017	}
    00018
    00019	//_____________________________________________________________________________
    00020	auto State Wandering
    00021	{
    00022	    function vector PickDestination(XIIITransientAPawn P)
    00023	    {
    00024	      local vector Dest;
    00025	      local XIIIBird B;
    00026
    00027	//      log(self$" Wandering PickDestination call");
    00028	      if ( P.bDestroySoon && (P.LastRenderTime > 1) )
    00029	      {
    00030	        P.Destroy();
    00031	        return P.Location;
    00032	      }
    00033	      B = XIIIBird(P);
    00034	      if ( FRand() < 0.5 )
    00035	        B.PlayCall();
    00036	//      Dest = FRand() * B.CircleRadius * VRand();
    00037	//      Dest.Z /= 2.0;
    00038	//      Dest += StartingSpot.Location + vect(0,0,100) + vect(0,0,1)*B.HeightOffset;
    00039	      Dest = StartingSpot.Location + vect(0,0,100) + vect(0,0,1)*B.HeightOffset;
    00040	/*
    00041	      if ( VSize(MyManager.LocalPlayer.Pawn.Location - B.Location) < FlockRadius )
    00042	        Dest.Z = FMax(Dest.Z,Location.Z) + 300;
    00043	      if ( Location.Z - Dest.Z > 200 )
    00044	        Dest.Z = Location.Z;
    00045	*/
    00046	      B.PlayGlideOrFly(Dest);
    00047	      return Dest;
    00048	    }
    00049
    00050	    function PickSlaveDestination(XIIITransientAPawn P)
    00051	    {
    00052	      local vector Dest;
    00053
    00054	      Dest = PickDestination(P);
    00055
    00056	      if ( P.bDeleteMe )
    00057	        return;
    00058
    00059	      P.Acceleration = P.AccelRate * Normal(Dest - P.Location);
    00060	      P.SleepTime = VSize(Dest - P.Location)/P.AirSpeed;
    00061	      P.DesiredRotation = Rotator(P.Acceleration);
    00062	    }
    00063
    00064	    function BeginState()
    00065	    {
    00066	      if ( NumSlaves > 0 )
    00067	        AddSlaves(XIIITransientAPawn(Pawn),NumSlaves);
    00068	    }
    00069	}
    00070
    00071
    00072
    00073	defaultproperties
    00074	{
    00075	     fSecurityDist=400
    00076	     MinSpawnDist=1500.000000
    00077	     MaxSpawnDist=15000.000000
    00078	     bCollideWorld=True
    00079	     Tag="'"
    00080	     CollisionRadius=80.000000
    00081	     CollisionHeight=60.000000
    00082	}

End Source Code