示例#1
0
    // Do the math only when some light is in bound.
    void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Orb") && other.gameObject.layer != hintLightLayer)
        {
            if ((other.transform.parent != null && getGrabbableObjectFromChild(other.gameObject) == null) && other.transform.parent.CompareTag("Player"))
            {
                playerInSight = true;
            }
            else
            {
                lightInSight++;

                // Pass the OnTriggerExit to other if other is mushroom
                GrabbableObject cbTarget = other.GetComponentInParent <GrabbableObject> ();
                if (cbTarget != null)
                {
                    cbTarget.AddReleaseCallBack(other, OnTriggerExit);
                }
            }
        }
    }