Esempio n. 1
0
 private void OnTriggerStay(Collider other)
 {
     if (other.tag == "Head")
     {
         PlayerController playerController = other.GetComponentInParent <PlayerController>();
         if (playerController)
         {
             //Debug.Log("HeadInWater");
             playerController.IsHeadWatered = true;
             playerController.IsGrounded    = false;
         }
     }
     else if (other.tag == "Player")
     {
         //Debug.Log("BodyInWater");
         PlayerController playerController = other.GetComponent <PlayerController>();
         if (playerController)
         {
             playerController.IsBodyWatered = true;
         }
     }
     else if (other.transform.root.tag == "Horse")
     {
         MalbersAnimations.Animal animal = other.GetComponentInParent <MalbersAnimations.Animal>();
         if (animal)
         {
             animal.RaycastWater();
         }
     }
 }
Esempio n. 2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Head")
     {
         PlayerController playerController = other.GetComponentInParent <PlayerController>();
         if (playerController)
         {    //Debug.Log("HeadIntoWater");
             playerController.IsHeadWatered = true;
             playerController.IsGrounded    = false;
             //playerController.m_Rigidbody.Sleep();
             playerController.m_Rigidbody.useGravity = false;
             playerController.moveAble   = true;
             playerController.rotateAble = true;
         }
     }
     else if (other.tag == "Player")
     {
         PlayerController playerController = other.GetComponent <PlayerController>();
         if (playerController)
         {
             playerController.IsBodyWatered = true;
         }
     }
     else if (other.tag == "HeadCheck")
     {
         PlayerController playerController = other.GetComponentInParent <PlayerController>();
         if (playerController)
         {
             if (!playerControllers.Contains(playerController))
             {
                 playerControllers.Add(playerController);
             }
         }
     }
     else if (other.transform.root.tag == "Horse")
     {
         //Debug.Log("HorseIn");
         MalbersAnimations.Animal animal = other.GetComponentInParent <MalbersAnimations.Animal>();
         if (animal)
         {
             animal.RaycastWater();
         }
     }
 }