public void takeDamage(Purse purse) { Debug.Log("I was hit by a Ray"); health -= damage; if (health <= 0) { Debug.Log("I'm DEAD!"); int coins = typeA ? 10 : 20; purse.increasePurse(coins); Destroy(gameObject); } }
public void takeDamage(Purse purse) { Debug.Log("OUCH!"); health -= damage; healthbar.fillAmount = health / startHealth; if (health <= 0) { Debug.Log("I'm DEAD!"); int coins = typeA ? 10 : 20; purse.increasePurse(coins); StartCoroutine(Die()); } }