Esempio n. 1
0
    void OnTriggerExit(Collider other)
    {
        // Only do this if the thing entering has the triggering object component
        //and that it is currently triggering stuff
        IsTriggeringObject trigger = other.gameObject.GetComponent <IsTriggeringObject>();

        if (trigger != null)
        {
            // Remove the trigger from the list of eventObjs
            for (int i = 0; i < objectsOnButton.Count; i++)
            {
                if (objectsOnButton[i].trigger == trigger)
                {
                    trigger.RemoveChangedStatusFunction(objectsOnButton[i]);
                    objectsOnButton.RemoveAt(i);
                    break;
                }
            }

            if (trigger.IsCurrentlyTriggering)
            {
                BlocksOnButton--;

                // If there isn't a block here anymore
                if (BlocksOnButton == 0)
                {
                    // Inactivate the button
                    signal.Trigger();
                }
            }

            if (objectsOnButton.Count == 0)
            {
                // Make the material inactive too
                ChangeIndicatorMaterial(inactive);
            }
            else if (objectsOnButton.Count > 0 && BlocksOnButton == 0)
            {
                ChangeIndicatorMaterial(couldBeActive);
            }
        }
    }
Esempio n. 2
0
    void OnTriggerExit(Collider other)
    {
        // Only do this if the thing entering has the triggering object component
        //and that it is currently triggering stuff
        IsTriggeringObject trigger = other.gameObject.GetComponent <IsTriggeringObject>();

        if (trigger != null)
        {
            // Remove the trigger from the list of eventObjs
            for (int i = 0; i < objectsOnButton.Count; i++)
            {
                if (objectsOnButton[i].trigger == trigger)
                {
                    trigger.RemoveChangedStatusFunction(objectsOnButton[i]);
                    objectsOnButton.RemoveAt(i);
                    break;
                }
            }
        }
    }