Exemplo n.º 1
0
    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;
        }
    }
Exemplo n.º 2
0
 public PowerUp(string _powerUpName, bool _hasDuration, float _duration, float _powerUpValue, EPowerUps _powerUp)
 {
     powerUpName  = _powerUpName;
     hasDuration  = _hasDuration;
     duration     = _duration;
     powerUpValue = _powerUpValue;
     powerUp      = _powerUp;
 }
Exemplo n.º 3
0
    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);
    }
Exemplo n.º 4
0
    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;
        }
    }