// Update is called once per frame void Update() { if (health <= 0) { health = 0; blackboard.UpdateDeath(); Instantiate(deadPlayer, transform.position, Quaternion.identity); Instantiate(ghost, transform.position, Quaternion.identity); Destroy(gameObject); } if (health >= maxHealth) { health = maxHealth; } }