Example #1
0
    private void OnCollisionEnter(Collision tanque)
    {
        GameObject colision       = tanque.gameObject;
        Rigidbody  colisionCuerpo = colision.GetComponent <Rigidbody>();

        if (tanque.gameObject.CompareTag("Jugador"))
        {
            Motor other = (Motor)tanque.gameObject.GetComponent(typeof(Motor));
            other.Destruir();
        }

        if (tanque.gameObject.CompareTag("Construccion"))
        {
            Construccion other = (Construccion)cons.gameObject.GetComponent(typeof(Construccion));
        }
    }