public void EnemyAttack(int damage) { playerHealthDisplay.GetComponent <Animator>().SetTrigger("Damage Trigger"); //if player loses all life - lose player.TakeDamage(damage); playerHealthDisplay.UpdateDisplay(); playerArmorDisplay.UpdateDisplay(); }
public static void Heal(int heal) { instance.curhealth += heal; if (instance.curhealth > instance.Health) { instance.curhealth = instance.Health; } HealthDisplay.UpdateDisplay(instance.curhealth, instance.Health); }
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(); } }
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); }
public static void HealMax() { instance.curhealth = instance.Health; HealthDisplay.UpdateDisplay(instance.curhealth, instance.Health); }