Esempio n. 1
0
 public void EnemyAttack(int damage)
 {
     playerHealthDisplay.GetComponent <Animator>().SetTrigger("Damage Trigger");
     //if player loses all life - lose
     player.TakeDamage(damage);
     playerHealthDisplay.UpdateDisplay();
     playerArmorDisplay.UpdateDisplay();
 }
Esempio n. 2
0
 public static void Heal(int heal)
 {
     instance.curhealth += heal;
     if (instance.curhealth > instance.Health)
     {
         instance.curhealth = instance.Health;
     }
     HealthDisplay.UpdateDisplay(instance.curhealth, instance.Health);
 }
Esempio n. 3
0
    public void RemoveHeart()
    {
        hearts--;
        healthDisplay.UpdateDisplay();
        AudioSource.PlayClipAtPoint(badJobClip, Camera.main.transform.position);

        if (hearts <= 0)
        {
            gameOver         = true;
            Time.timeScale   = 1;
            Cursor.visible   = true;
            Cursor.lockState = CursorLockMode.None;
            Player p = FindObjectOfType <Player>();
            p.GetComponent <RigidbodyFirstPersonController>().enabled = false;
            gameOverMenu.GameOver();
        }
    }
Esempio n. 4
0
    public static void TakeDamage(int damage)
    {
        if (instance.GetComponent <Stats>().invuln)
        {
            return;
        }
        instance.GetComponent <Stats>().damageCo();



        instance.curhealth -= damage;
        AudioManager.PlayerHurt();
        if (instance.curhealth <= 0)
        {
            instance.curhealth = 0;
            Die();
        }
        HealthDisplay.UpdateDisplay(instance.curhealth, instance.Health);
    }
Esempio n. 5
0
 public static void HealMax()
 {
     instance.curhealth = instance.Health;
     HealthDisplay.UpdateDisplay(instance.curhealth, instance.Health);
 }