Ejemplo n.º 1
0
    public void PlayerDamage()
    {
        _cAction = PLAYERACTIONS.takeDamage;
        if (shield != true)
        {
            currentHealth -= 1;
        }
        else
        {
            shield = false;
            AddShield(shield);
        }

        if (playerGUI != null)
        {
            playerGUI.HPChange(currentHealth);
        }

        if (currentHealth == 0)
        {
            Instantiate(Resources.Load("BigExsplosion"), transform.position, transform.localRotation);
            EntityManager.ResetWave();
            acceleration = Vector3.zero;
            velocity     = Vector3.zero;
            _fsm.Transition(_fsm.state, PLAYERSTATES.dead);
            livesRemaining -= 1;
            if (livesRemaining >= 0)
            {
                LivesRemaining.RemoveLife();
                _cAction                = PLAYERACTIONS.die;
                transform.position      = spawnPosition;
                well.transform.position = spawnPosition;
                PlayerSpawn();
                currentHealth = maxHealth;
                if (GODMODE == true)
                {
                    livesRemaining += 1;
                }
            }
            else if (livesRemaining < 0)
            {
                _fsm.Transition(_fsm.state, PLAYERSTATES.destroyed);
                GameStates.ChangeState("GameOver");
            }
        }
        DylanGamePlay.UpdatePlayer(currentHealth, livesRemaining);
    }
Ejemplo n.º 2
0
    public void PlayerDamage()
    {
        _cAction       = PLAYERACTIONS.takeDamage;
        currentHealth -= 1;
        if (playerGUI != null)
        {
            playerGUI.HPChange(currentHealth);
        }

        if (currentHealth == 0)
        {
            EntityManager.ResetWave();
            acceleration = Vector3.zero;
            velocity     = Vector3.zero;
            FindObjectOfType <AudioManager>().PlayExplodeAudio();
            _fsm.Transition(_fsm.state, PLAYERSTATES.dead);
            livesRemaining -= 1;
            if (livesRemaining >= 0)
            {
                _cAction                = PLAYERACTIONS.die;
                transform.position      = spawnPosition;
                well.transform.position = spawnPosition;
                PlayerSpawn();
                currentHealth = maxHealth;
                if (GODMODE == true)
                {
                    livesRemaining += 1;
                }
            }
            else if (livesRemaining < 0)
            {
                _fsm.Transition(_fsm.state, PLAYERSTATES.destroyed);
                GameStates.ChangeState("GameOver");
            }
        }
    }