UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 6

183

if( Vehicle(Other) != None )
{
// If a vehicle touches it...
if(bDestroyOnVehicleTouch)
{
// Explode
Explode();
}
}
else
{
// If a player touches it...
if(bDestroyOnPlayerTouch && Pawn(other) !=None)
{
// Explode
Explode();
}
}
}

For now, it will only detonate when run over (touched) by a vehicle. We can easily
turn this on or off, as well as for a pawn, in the defaultproperties block.


  1. The last part of this class is the defaultproperties block. Let's define our
    values now:
    defaultproperties
    {
    bCollideActors=TRUE
    bProjTarget=TRUE
    bPathColliding=FALSE
    bNoDelete=TRUE
    Begin Object Name=MyLightEnvironment
    bEnabled=TRUE
    bDynamic=FALSE
    End Object


// Mesh for the object
Begin Object Name=StaticMeshComponent0
StaticMesh=StaticMesh'E3_Demo.Meshes.SM_Barrel_01'
End Object

ParticlesOnDestroy[0]=
ParticleSystem'Castle_Assets.FX.P_FX_Fire_SubUV_01'
Free download pdf