public void GotHit(int hp) { hitPoints = hp; if (hitPoints > 0) { col.enabled = true; } else { myParent.GetComponent <HoleBehavior>().hasMole = false; ScoreManager.AddScore(score); GameObject pop = Instantiate(popupText) as GameObject; pop.transform.SetParent(UIManager.instance.transform, false); pop.transform.position = Camera.main.WorldToScreenPoint(transform.position); PopupText popText = pop.GetComponent <PopupText>(); popText.Showtext(score); Destroy(gameObject); } }