## XIDPawn
Class GenColvert

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

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Keypoint
             |
             +--XIDPawn.GenFRD
                |
                +--XIDPawn.GenColvert

Direct Known Subclasses:None

class GenColvert
extends XIDPawn.GenFRD

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

Variables
`array` | `Liste_PointsDeGen`
`int` | `NbColvertGen`
`int` | `NbColverts`
`int` | `NbMorts`
`int` | `NbMorts_A_Attendre`
`int` | `NbPoints`
`Colvert` | `SpawnDuck`
`float` | `TempsEntreGen`
`bool` | `bFirstDuck`
`int` | `iNumPoint`
`XIIIPlayerPawn` | `xiii`

Function Summary
`void` | `PostBeginPlay()`

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class GenColvert extends GenFRD;
    00005
    00006	var (GenColvert) int NbColvertGen;
    00007	var (GenColvert) float TempsEntreGen;
    00008	var (GenColvert) array<pathnode> Liste_PointsDeGen;
    00009	var (GenColvert) int NbMorts_A_Attendre;
    00010
    00011	var Colvert SpawnDuck;
    00012	var xiiiplayerpawn xiii;
    00013	var int NbMorts;
    00014	var int NbColverts;
    00015	var int NbPoints;
    00016	var int iNumPoint;
    00017	var bool bFirstDuck;
    00018
    00019	function PostBeginPlay()
    00020	{
    00021		if (Liste_PointsDeGen.length<=0)
    00022		{
    00023			log("************* PAS DE POINT ASSOCIE DESTROY **************"@self);
    00024			destroy();
    00025		}
    00026		settimer2(0.5+0.5*frand(),false);
    00027
    00028	}
    00029
    00030	event Trigger( actor Other, pawn EventInstigator )
    00031	{
    00032	}
    00033
    00034	event timer()
    00035	{
    00036		if (NbMorts_A_Attendre<=NbMorts)
    00037			gotostate('actif');
    00038		else
    00039			gotostate('inactif');
    00040	}
    00041	event timer2()
    00042	{
    00043		xiii=XIIIplayerpawn(xiiigameinfo(level.game).mapinfo.XIIIpawn);
    00044	}
    00045
    00046	// ----------------------------------------------------------------------
    00047	//   Etat Inactif
    00048	//
    00049	// ----------------------------------------------------------------------
    00050	state() Inactif
    00051	{
    00052	   event Trigger( actor Other, pawn EventInstigator )
    00053		{
    00054			local vector vVect;
    00055
    00056			NbMorts++;
    00057			if (NbMorts>=NbMorts_A_Attendre)
    00058			{
    00059				tag='';
    00060				disable('trigger');
    00061				vVect=location-xiii.location;
    00062				if (abs(vVect.z)<collisionheight && vsize(vVect*vect(1,1,0))<collisionradius)
    00063				{
    00064					disable('touch');
    00065					gotostate('actif','genere');
    00066				}
    00067				else
    00068					gotostate('actif');
    00069			}
    00070		}
    00071		event timer()
    00072		{
    00073		}
    00074	begin:
    00075		//log(self@"state inactif");
    00076	}
    00077
    00078	// ----------------------------------------------------------------------
    00079	//   Etat Actif
    00080	//
    00081	// ----------------------------------------------------------------------
    00082	state() Actif
    00083	{
    00084		event timer()
    00085		{
    00086		}
    00087		event touch(actor other)
    00088		{
    00089			if (other==xiii && xiii.weapon.isa('fusilchasse'))
    00090			{
    00091				disable('touch');
    00092				gotostate('Actif','genere');
    00093			}
    00094		}
    00095	begin:
    00096		//log(self@"state actif");
    00097		stop;
    00098	genere:
    00099		iNumPoint=rand(Liste_PointsDeGen.length);
    00100		//log("genese"@Liste_PointsDeGen[iNumPoint]@NbColvertGen@NbColverts);
    00101		SpawnDuck=spawn(class'Colvert',self,,Liste_PointsDeGen[iNumPoint].location,Liste_PointsDeGen[iNumPoint].rotation);
    00102		if (SpawnDuck!=none)
    00103		{
    00104			if (!bFirstDuck)
    00105			{
    00106
    00107				SpawnDuck.PlaySound(Sound'XIIIsound.Ambient__Kello1a_Duck.Kello1a_Duck__hBirdTakeOff1');
    00108	       	bfirstduck=true;
    00109				SpawnDuck.PlaySound(Sound'XIIIsound.Ambient__Kello1a_Duck.Kello1a_Duck__hDuck1');
    00110			}
    00111			if (Liste_PointsDeGen[iNumPoint].collisionradius!=0)
    00112				SpawnDuck.AltitudeMax=Liste_PointsDeGen[iNumPoint].collisionradius;
    00113			NbColverts++;
    00114			if (NbColverts>=NbColvertGen)
    00115			{
    00116				destroy();
    00117			}
    00118		}
    00119		Settimer(TempsEntreGen,false);
    00120		gotostate('');
    00121	}
    00122
    00123
    00124
    00125
    00126
    00127	defaultproperties
    00128	{
    00129	     NbColvertGen=1
    00130	     TempsEntreGen=10.000000
    00131	     bCollideActors=True
    00132	     InitialState="Inactif"
    00133	}

End Source Code