/// <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();
        }
Exemple #2
0
        /// <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();
        }