Game Development Reference
In-Depth Information
var() SoundCue SoundOnDestroy;
/** Particles to play when destroyed. */
var() ParticleSystem ParticlesOnDestroy;
/** Allows particles to be turned on/off. */
var() ParticleSystemComponent PSC;
/** Static mesh to spawn as physics object when destroyed. */
var() StaticMesh SpawnPhysMesh;
/** Time between being destroyed & respawning. */
var() float RespawnTime;
/** Set the mesh back to the original upon respawning */
var StaticMesh RespawnSM;
/** Is the barrel currently destroyed? */
var bool bDestroyed;
/** Time before we are going to respawn. */
var float TimeToRespawn;
2. Our first function is simply PostBeginPlay() . Here we set RespawnSM
(respawn static mesh) to use our static mesh component.
* Setting respawn mesh to use our static mesh
simulated function PostBeginPlay()
// Uses this mesh when respawning
RespawnSM = StaticMeshComponent.StaticMesh;
When our barrel explodes, we'll need a way to set it back to its original condition
when it respawns. We do this with the RespawnDestructable() function. Here,
we reset the static mesh and then reattach the static mesh component. Additionally,
we turn off the particle system, so that we no longer see the smoke and fire from the
previously destroyed barrel.
* Place destroyed item back in original condition
Search Nedrilad ::

Custom Search