Пример #1
0
 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();
     }
 }
Пример #2
0
    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();
        }
    }