void OnControllerColliderHit(ControllerColliderHit hit)
 {
     if (cachedObject == hit.transform.gameObject)
         if (cachedCH)
             cachedCH.OnCharacterCollided(hit, transform);
         else
             return;
     else
     {
         cachedObject = hit.transform.gameObject;
         cachedCH = hit.transform.gameObject.GetComponent<PlayerCollisionHandler>();
     }
     if (cachedCH)
         cachedCH.OnCharacterCollided(hit, transform);
 }
Пример #2
0
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     if (cachedObject == hit.transform.gameObject)
     {
         if (cachedCH)
         {
             cachedCH.OnCharacterCollided(hit, transform);
         }
         else
         {
             return;
         }
     }
     else
     {
         cachedObject = hit.transform.gameObject;
         cachedCH     = hit.transform.gameObject.GetComponent <PlayerCollisionHandler>();
     }
     if (cachedCH)
     {
         cachedCH.OnCharacterCollided(hit, transform);
     }
 }