/// <summary>
 /// OnCollisionEnter is called when this collider/rigidbody has begun
 /// touching another rigidbody/collider.
 /// </summary>
 /// <param name="other">The Collision data associated with this collision.</param>
 void OnCollisionEnter(Collision other)
 {
     if (other.collider.tag == "Parede")
     {
         individuo.Morrer();
     }
 }
예제 #2
0
    /// <summary>
    /// OnTriggerEnter is called when the Collider other enters the trigger.
    /// </summary>
    /// <param name="other">The other Collider involved in this collision.</param>
    void OnTriggerEnter(Collider other)
    {
        string tag = other.tag;

        switch (tag)
        {
        case "MeioPista":
            passouDoMeioDaPista = true;
            break;

        case "Chegada":
            if (passouDoMeioDaPista)
            {
                individuo.Morrer();
            }
            break;
        }
    }