private void OnTriggerStateEvent(Gaze_TriggerStateEventArgs _e) { // If we are not in proximity we don't need to do anything else if (!IsInProximity) { return; } // If the collision type is different from stay return if (!gazeConditionsScript.proximityMap.proximityStateIndex.Equals((int)ProximityEventsAndStates.OnStay)) { return; } // If it's not our gaze conditions script return if (!((GameObject)_e.Sender) == gazeConditionsScript.gameObject) { return; } if (_e.TriggerState == Gaze_TriggerState.ACTIVE) { // Ask the proximity map to compute is every object is colliding gazeConditionsScript.proximityMap.UpdateEveryoneColliding(); IsValid = gazeConditionsScript.proximityMap.IsEveryoneColliding; } }
private void OnTriggerStateEvent(Gaze_TriggerStateEventArgs e) { if (e.Sender != null) { // if I'm the gazed object if (!((GameObject)e.Sender).Equals(gameObject)) { if (dependent) { // check if the sender is one of my dependencies ValidateDependencies((GameObject)e.Sender, (int)e.TriggerState); } } } }
private void onTriggerStateEvent(Gaze_TriggerStateEventArgs e) { // if sender is the this Behaviour gameObject if ((GameObject)e.Sender == gameObject) { triggerState = e.TriggerState; switch (triggerState) { case Gaze_TriggerState.BEFORE: if (isDelayed) { HandleActionsInTime(() => OnBefore(), TriggerEventsAndStates.OnBefore); } else { OnBefore(); } break; case Gaze_TriggerState.ACTIVE: if (isDelayed) { HandleActionsInTime(() => OnActive(), TriggerEventsAndStates.OnActive); } else { OnActive(); } break; case Gaze_TriggerState.AFTER: if (isDelayed) { HandleActionsInTime(() => OnAfter(), TriggerEventsAndStates.OnAfter); } else { OnAfter(); } break; } } }
/// <summary> /// Method called when a trigger state events occur. /// </summary> /// <param name="e">event arguments</param> protected abstract void onTriggerStateEvent(Gaze_TriggerStateEventArgs e);