Ejemplo n.º 1
0
    public void Ini()
    {
        player = GetComponent <PLAYER>();
        Guardar_Posicion();
        currentHealth = startingHealth;

        gameManager = GameObject.FindGameObjectWithTag("GAMEMANAGER").GetComponent <GAMEMANAGER>();

        timeCounter = GameObject.FindGameObjectWithTag("TIME").GetComponent <TimeCounter>();

        // Update life UI
        gameManager.PlayerLife(currentHealth);
    }
Ejemplo n.º 2
0
    public void TakeDamage(int amount)
    {
        //smoothCamera.CameraDamage();
        damage = true;

        if (damage && currentHealth > 1)
        {
            Cargar_Posicion();
            timeCounter.ResetTiempo();
        }

        currentHealth -= amount;
        Pain.Play();

        if (currentHealth <= 0 && !isDead)
        {
            currentHealth = 0;
            Death();
        }

        // Update life UI
        gameManager.PlayerLife(currentHealth);
    }