private bool IsCorrectCollider(Collider other)
 {
     if (labelsToCheckFor.Length != 0)
     {
         ColliderLabel component = other.GetComponent <ColliderLabel>();
         if ((bool)component)
         {
             string[] array = labelsToCheckFor;
             foreach (string b in array)
             {
                 if (component.Label == b)
                 {
                     if (debugOutput)
                     {
                         Debug.Log("Correct collider found: " + other.name);
                     }
                     return(true);
                 }
                 if (debugOutput)
                 {
                     Debug.Log("Other collider label does not match: " + component.Label);
                 }
             }
         }
         else if (debugOutput)
         {
             Debug.Log("Other collider does not have a label: " + other.name);
         }
     }
     return(false);
 }
Example #2
0
        private void OnCollisionEnter(Collision collision)
        {
            if (debugColliderNames)
            {
                UnityEngine.Debug.LogError("Collision entered: " + collision.collider.gameObject.name);
            }
            ColliderLabel component = collision.collider.gameObject.GetComponent <ColliderLabel>();

            if ((bool)component)
            {
                if (component.Label == labelClub)
                {
                    if (timeSinceHit == 0f)
                    {
                        hitCount++;
                        timeSinceHit = 1f;
                    }
                }
                else if (component.Label == labelHole && hitCount <= maxHits && !grabbed)
                {
                    UnlockParAchievement();
                }
            }
            if (collision.collider.gameObject.GetComponentInParent <Ragdoll>() != null)
            {
                grabbed = true;
            }
        }