/// <summary> /// Initialize a ship to its default gameplay states. /// </summary> public override void Initialize() { if (!active) { // set the initial gameplay data values shipInput = ShipInput.Empty; rotation = 0f; velocity = Vector2.Zero; life = lifeMaximum; shield = shieldMaximum; shieldRechargeTimer = 0f; safeTimer = safeTimerMaximum; weapon = new LaserWeapon(this); mineWeapon = new MineWeapon(this); // play the player-spawn sound AudioManager.PlaySoundEffect("player_spawn"); // add the ship-spawn particle effect if (ParticleEffectManager != null) { ParticleEffectManager.SpawnEffect(ParticleEffectType.ShipSpawn, this); } // clear out the projectiles list projectiles.Clear(); } base.Initialize(); }
/// <summary> /// Initialize the rocket projectile to it's default gameplay states. /// </summary> public override void Initialize() { if (!active) { // get and play the rocket-flying sound effect AudioManager.PlaySoundEffect("rocket", true, out rocketSound); // start the rocket-trail effect if (ParticleEffectManager != null) { rocketTrailEffect = ParticleEffectManager.SpawnEffect( ParticleEffectType.RocketTrail, this); } } base.Initialize(); }
/// <summary> /// Kills this object, in response to the given GameplayObject. /// </summary> /// <param name="source">The GameplayObject responsible for the kill.</param> /// <param name="cleanupOnly"> /// If true, the object dies without any further effects. /// </param> public override void Die(GameplayObject source, bool cleanupOnly) { if (active) { // display the laser explosion if (!cleanupOnly && (ParticleEffectManager != null)) { ParticleEffectManager.SpawnEffect(ParticleEffectType.LaserExplosion, Position); } } base.Die(source, cleanupOnly); }
/// <summary> /// Kills this object, in response to the given GameplayObject. /// </summary> /// <param name="source">The GameplayObject responsible for the kill.</param> /// <param name="cleanupOnly"> /// If true, the object dies without any further effects. /// </param> public override void Die(GameplayObject source, bool cleanupOnly) { if (active) { if (!cleanupOnly) { // play the explosion sound effect AudioManager.PlaySoundEffect("explosion_large"); // play the mine particle-effect if (ParticleEffectManager != null) { ParticleEffectManager.SpawnEffect( ParticleEffectType.MineExplosion, Position); } } } base.Die(source, cleanupOnly); }