示例#1
0
 /// <summary>
 /// Gets called when health is 0 or lower.
 /// Sets the destroyed boolean and creates a powerup.
 /// </summary>
 public void Destruct()
 {
     if(!_destroyed)
     {
         Random random = new Random();
         if(random.NextDouble() <= _powerUpChance)
         {
             GameLogic gameLogic = GameLogic.GetInstance();
             Game game = gameLogic.GetGame();
             PowerUp powerUp = new PowerUp(game, GetPosition());
             gameLogic.AddPowerUp(powerUp);
             game.Components.Add(powerUp);
         }
         _destroyed = true;
     }
 }
示例#2
0
 public void AddPowerUp(PowerUp powerUp)
 {
     _powerUps.Add(powerUp);
 }
示例#3
0
 public void SetPowerUp(PowerUp powerUp)
 {
     _wpn = powerUp.GetPowerUp(_wpn);
 }