// Called whenever the interaction is interupted. protected virtual void OnInterrupted(InteractionInterruptEventArgs e) { var handler = Interrupted; if (handler != null) { handler(this, e); } }
// Called whenever this monobehaviour changes states. protected virtual void OnChangedStates(InteractionInterruptEventArgs e) { var handler = ChangedStates; if (handler != null) { handler(this, e); } }
// Called when an interaction is interrupted. protected virtual void Interaction_OnInterrupted(object sender, InteractionInterruptEventArgs e) { var interaction = (IInteractableState)sender; interaction.Interrupted -= Interaction_OnInterrupted; // Determines which controller was interrupted. SteamVR_Input_Sources fromSource = MapControllerToSource(e.Controller); if (fromSource == SteamVR_Input_Sources.Any) { Debug.LogErrorFormat("Error - 'Controller {0} - not mapped to left or right input source", e.Controller); return; } var stoppedInteractingState = GetControllerState(fromSource).NewInteractingState(null); SetControllerState(fromSource, stoppedInteractingState); }