public void RemoveInput(InputMethod inputMethod) { if (inputMethods.Contains(inputMethod)) { inputMethods.Remove(inputMethod); } }
public void AddInputMethod(InputMethod inputMethod) { if (!inputMethods.Contains(inputMethod)) { inputMethod.device = this; inputMethods.Add(inputMethod); } }
private void Start() { if (autoAddChildrenOnAwake) { for (int i = 0; i < transform.childCount; ++i) { InputMethod inputMethod = transform.GetChild(i).GetComponent <InputMethod>(); if (inputMethod != null) { AddInputMethod(inputMethod); } } } }
public void testAction(InputMethod inputMethod, float distance, InputHandler handler) { performedAction = performingAction; //Check if the input types are the same bool inputTypeMatches = (inputMethod.Type & type) != InputType.None; //If they are, check if the action is being performed performingAction = inputTypeMatches ? isPerformingAction(inputMethod, distance, handler) : false; if (!performedAction && performingAction) { OnActionStarted.Invoke(inputMethod, distance, handler); } if (performingAction) { OnActionUpdate.Invoke(inputMethod, distance, handler); } if (performedAction && !performingAction) { OnActionEnded.Invoke(inputMethod, distance, handler); } }
protected abstract bool isPerformingAction(InputMethod inputMethod, float distance, InputHandler handler);
protected override bool isPerformingAction(InputMethod inputMethod, float distance, InputHandler handler) { return(isPerformingAction(inputMethod as PointerInput, distance, handler)); }