public void AddPowerUp(HeroPowerUp powerUp) { powerUp.Activate(hero); numActivePowerUps++; // Send event if (OnPowerUpAdded != null) { OnPowerUpAdded(); } }
public void AddPowerUp(string name) { HeroPowerUp selectedPowerUp = GetPowerUp(name).GetComponent <HeroPowerUp> (); //print("Got power up:" + selectedPowerUp.gameObject); // test if this hero already has the selected power up if (selectedPowerUp.isActive) { //print("Stacking..."); selectedPowerUp.Stack(); } else { //print("Power up not active. Activating..."); selectedPowerUp.gameObject.SetActive(true); selectedPowerUp.Activate(hero); numActivePowerUps++; } // send event if (OnPowerUpAdded != null) { OnPowerUpAdded(); } }