void checkTaskFailed() { if (LifeBarScript.getHealth() <= threshold) { gameObject.SetActive(!gameObject.activeSelf); } }
// Update is called once per frame void Update() { checkTaskFailed(); if (LifeBarScript.getHealth() == 0) { gameOver(); } }