void OnTriggerEnter(Collider other) { if (other.tag == "Bot") { score++; scoreText.text = score.ToString("D3"); //gets the attack bot parent AttackBot b = other.GetComponentInParent <AttackBot>(); //calls the body and disables the collider. b.blowUp(); } }
void OnTriggerEnter(Collider other) { if (other.tag == "Bot") { health--; healthText.text = health.ToString("D2"); if (health == 0) { Time.timeScale = 0; } //gets the attack bot parent AttackBot b = other.GetComponentInParent <AttackBot>(); //calls the body and disables the collider. b.blowUp(); } }