/// <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; } }
public void AddPowerUp(PowerUp powerUp) { _powerUps.Add(powerUp); }
public void SetPowerUp(PowerUp powerUp) { _wpn = powerUp.GetPowerUp(_wpn); }