XIDCine
Class MotorBoat

source: C:\XIII\XIDCine\Classes\MotorBoat.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Decoration
         |
         +--XIII.VehicleDeco
            |
            +--XIII.BoatDeco
               |
               +--XIDCine.MotorBoat
Direct Known Subclasses:None

class MotorBoat
extends XIII.BoatDeco

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 string CrashLabel
 Emitter ExploEmitter
 int InitialHealth
 bool bDying
 bool bExplodeIfDead

States
Dying
State Dying Function Summary



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class MotorBoat extends BoatDeco;
00005	
00006	VAR() bool bExplodeIfDead;
00007	VAR bool bDying;
00008	VAR(Crash) int Health, DamageAmount, DamageRadius;
00009	VAR int InitialHealth;
00010	VAR() string CrashLabel;
00011	VAR(Sound) Sound SoundExplosion;
00012	VAR(Events) name CrashEvent;
00013	VAR(Events) name DeadEvent;
00014	VAR	Emitter SmokeEmitter;
00015	VAR Emitter ExploEmitter;
00016	
00017	FUNCTION TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType )
00018	{
00019		if ( !bDying && instigatedBy.IsPlayerPawn() )
00020		{
00021			Health= Max(0,Health-Damage);
00022			if (SmokeEmitter==none)
00023			{
00024				SmokeEmitter=Spawn(class'HelicoHSEmitter',,,Location+346*(vect(0,0,1) cross vector(Rotation)));
00025				SmokeEmitter.SetBase(self);
00026			}
00027			if ( SmokeEmitter!=none )
00028			{
00029				SmokeEmitter.Emitters[0].InitialParticlesPerSecond = 0.3333 * (1-float(Health)/InitialHealth);	
00030				SmokeEmitter.Emitters[0].ParticlesPerSecond = 0.3333 * (1-float(Health)/InitialHealth);	
00031			}
00032			if (Health==0)
00033			{
00034				bDying=true;
00035				DebugLog( "CRASH" );
00036				if ( bExplodeIfDead )
00037				{
00038					ExploEmitter= spawn(class'HelicoExploEMitter',,,Location+vect(0,0,64)/* HitLocation+400*Normal(instigatedBy.Location-HitLocation)*/);
00039	//				HurtRadius( 5000/*DamageAmount*/, 500/*DamageRadius*/, class'DTGrenaded', 0, HitLocation );	
00040					PlaySound(SoundExplosion/*,SoundExplosionType*/);
00041					if ( SmokeEmitter!=none)
00042						SmokeEmitter.Destroy();
00043					GotoState( 'Dying' );
00044				}
00045				else
00046					if ( Cine2(LinkedTo)!=none )
00047					{
00048						DebugLog( "CRASH sent to cine2" );
00049						Cine2(LinkedTo).CineController.CineGoto( CrashLabel );
00050					}
00051			}
00052		}
00053	}
00054	
00055	STATE Dying
00056	{
00057		FUNCTION TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType )
00058		{
00059		}
00060	Begin:
00061		SetCollision(false,false,false);
00062		TriggerEvent( CrashEvent, self, none );
00063		Sleep( 1.0 );
00064		TriggerEvent( DeadEvent, self, none );
00065		Destroy( );
00066	}
00067	
00068	
00069	
00070	defaultproperties
00071	{
00072	     bExplodeIfDead=True
00073	     Health=350
00074	     CrashLabel="Crash"
00075	     SoundExplosion=Sound'XIIIsound.Explo__GenExplo.GenExplo__hGenExplo'
00076	     CrashEvent="Crash"
00077	}

End Source Code