void OnCollisionEnter(Collision col) { if (col.gameObject.tag == "Player") { DeathController dc = col.gameObject.GetComponent <DeathController>(); dc.Die(); } }
public void ModifyHealth(int change) { if (!isAlive) { return; } hitpoints = Mathf.Clamp(hitpoints + change, 0, maxHitpoints); if (hitpoints <= 0) { hitpoints = 0; isAlive = false; player.DisableInput(true); StartCoroutine(DeathSequence()); IEnumerator DeathSequence() { deathController.Die(); yield return(new WaitForSeconds(2)); GameSceneController.Instance.GameOver(); } } }