public IEnumerator TriggerPowerUp(EPowerUps power, float value) { switch (power) { case EPowerUps.Invincible: isInvincible = true; Debug.Log("Starting"); yield return(new WaitForSeconds(value)); Debug.Log("Ending"); isInvincible = false; break; case EPowerUps.Regen: canLoseHealth = false; Debug.Log("Starting"); yield return(new WaitForSeconds(value)); Debug.Log("Ending"); canLoseHealth = true; break; default: yield return(null); break; } }
public PowerUp(string _powerUpName, bool _hasDuration, float _duration, float _powerUpValue, EPowerUps _powerUp) { powerUpName = _powerUpName; hasDuration = _hasDuration; duration = _duration; powerUpValue = _powerUpValue; powerUp = _powerUp; }
public void SpawnPowerUp(EPowerUps powerUp) { GameObject regen = Instantiate(PrefabsArray[(int)powerUp]) as GameObject; regen.transform.SetParent(this.transform); float distance = Random.Range(minPowerUpDistance, maxPowerUpDistance); SpawnVector.x = mainCamera.transform.position.x + distance; regen.transform.position = SpawnVector; ActivePowerUpsList.Add(regen); }
public void TriggerPowerUp2(EPowerUps power, float time) { switch (power) { case EPowerUps.Invincible: isInvincible = true; isInvincible = false; break; case EPowerUps.Regen: canLoseHealth = false; canLoseHealth = true; break; } }