Esempio n. 1
0
    public void GetDamage(float damage)
    {
        if (currentLife > 0)
        {
            currentLife -= damage;

            if (currentLife <= 0)
            {
                Destroy(gameObject);
                gameManager.SearchEnemy(gameObject);
                //Debug.Log("Se murió el enemy");
                animatorController.SetBool(deadAnimation, true);
                characterinputScript.GetKilled();
            }
            else
            {
                animatorController.SetTrigger("GetHitted");
            }
        }
    }
Esempio n. 2
0
 public void GetDamage(float damage)
 {
     Debug.Log("GetDamage del Player");
     if (currentLife > 0)
     {
         currentLife -= damage;
         UIM.updateLifeBar(currentLife);
         Debug.Log("currentLife: " + currentLife);
         if (currentLife <= 0)
         {
             Debug.Log("Murio el player");
             animatorController.SetTrigger("Died");
             animatorController.SetBool("IsRunning", false);
             characterinputScript.GetKilled();
             looseEvent.Invoke();
         }
         else
         {
             animatorController.SetTrigger("GetHitted");
         }
     }
 }