## XIDPawn
Class Colvert

source: C:\XIII\XIDPawn\Classes\Colvert.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Pawn
             |
             +--XIII.XIIIAmbientPawn
                |
                +--XIDPawn.Colvert

Direct Known Subclasses:None

class Colvert
extends XIII.XIIIAmbientPawn

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

Variables
`float` | `AltitudeDepart`
`float` | `AltitudeMax`
`XIIIPlayerPawn` | `XIII`
`vector` | `direction`
`XIIIGameInfo` | `gameinf`

States
init, DuckDying

State init Function Summary

State DuckDying Function Summary
`void` | `PlayFlying()`
`void` | `Landed(vector HitNormal)`

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class Colvert extends XIIIAmbientPawn;
    00005
    00006	var vector direction;
    00007	var xiiiplayerpawn XIII;
    00008	var Xiiigameinfo gameinf;
    00009	var float AltitudeDepart;
    00010	var float AltitudeMax;
    00011
    00012
    00013	State DuckDying
    00014	{
    00015	ignores Trigger, animend, Bump, HitWall, HeadVolumeChange, PhysicsVolumeChange, Falling, BreathTimer;
    00016		function Landed(vector HitNormal)
    00017		{
    00018			if (vsize(velocity)<50)
    00019			{
    00020				SetPhysics(PHYS_None);
    00021				SetCollision(false, false, false);
    00022			}
    00023		}
    00024		event timer()
    00025		{
    00026			if ((self.location-xiii.location) dot vector(xiii.rotation)<0 || !Fasttrace(xiii.location))
    00027				destroy();
    00028		}
    00029		function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation,
    00030								Vector momentum, class<DamageType> damageType) {}
    00031	Begin:
    00032		settimer(2,true);
    00033	}
    00034
    00035	function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation,
    00036							Vector momentum, class<DamageType> damageType)
    00037	{
    00038		if (health<=0)
    00039			return;
    00040		spawn(class'DeadDuckEmitter');
    00041		health=0;
    00042		Died(none, damageType, HitLocation);
    00043		AddVelocity(momentum/Mass);
    00044	}
    00045
    00046	//_____________________________________________________________________________
    00047	function Died(Controller Killer, class<DamageType> damageType, vector HitLocation)
    00048	{
    00049	    PlayDying(DamageType, HitLocation);
    00050		 bCollideWorld=true;
    00051		 playanim('plane',5);
    00052	    GotoState('DuckDying');
    00053	}
    00054
    00055
    00056	function PlayFlying()
    00057	{
    00058	   loopanim('vole',1.5);
    00059	}
    00060
    00061	event timer()
    00062	{
    00063		if (!Fasttrace(xiii.location))
    00064			destroy();
    00065		else if (abs(location.z-AltitudeDepart)>AltitudeMax)
    00066		{
    00067			velocity=300*direction*vect(1,1,0);
    00068			acceleration=velocity;
    00069			setrotation(rotator(velocity));
    00070			loopanim('plane');
    00071		}
    00072	}
    00073	// ----------------------------------------------------------------------
    00074	// ETAT INIT
    00075	//
    00076	//
    00077	// ----------------------------------------------------------------------
    00078	auto state init
    00079	{
    00080
    00081	begin:
    00082		setphysics(PHYS_Flying);
    00083		direction=vector(rotation);
    00084		velocity=300*direction;
    00085		acceleration=velocity;
    00086		direction=10000*direction+location;
    00087		settimer(3,true);
    00088		AltitudeDepart=location.z;
    00089		XIII=XIIIPlayerpawn(xiiigameinfo(level.game).mapinfo.XIIIpawn);
    00090		if (XIII==none || xiii.bisdead)
    00091			destroy();
    00092		PlayFlying();
    00093	}
    00094
    00095		 //bBlockZeroExtentTraces=false
    00096	    //bBlockNonZeroExtentTraces=false
    00097
    00098
    00099	defaultproperties
    00100	{
    00101	     AltitudeMax=800.000000
    00102	     Health=1
    00103	     ControllerClass=None
    00104	     bCollideWorld=False
    00105	     bBlockActors=False
    00106	     bBlockPlayers=False
    00107	     Mesh=SkeletalMesh'XIIIPersos.CanardM'
    00108	     SaturationDistance=800.000000
    00109	     StabilisationDistance=2500.000000
    00110	     CollisionHeight=20.000000
    00111	}

End Source Code