void ClearTouches() { gesture = null; }
public void HandleGesture(GestureEventData[] gestureEvents) { }
void Update() { float dt = Time.deltaTime; var touches = 0; #if UNITY_EDITOR if (Input.GetKey(KeyCode.Z) || Input.GetKeyUp(KeyCode.Z)) // Pinch anchor { ++touches; } else if (Input.GetKey(KeyCode.X) || Input.GetKeyUp(KeyCode.X)) // Swipe anchor { ++touches; } if (Input.GetMouseButton(0) || Input.GetMouseButtonUp(0)) // Last touch { ++touches; } #else touches = Input.touchCount; #endif touches_1 = touches; if (touches > 0) { touchLifetime += Time.deltaTime; } if (touches_1 != touches_0) { if (touches > 0) { var activeTouches = FetchTouches(); if (gesture == null) { gesture = new GestureEventData(input, activeTouches); } else { gesture.input = input; gesture.touches = activeTouches; } } else { ClearTouches(); EventManager.TriggerEvent(Constants.EventNames.RELEASE_TOUCH, touchLifetime); touchLifetime = 0f; } } touches_0 = touches_1; if (gesture != null) { gesture.Update(); // Update active gesture } if (GetTap()) { EventManager.TriggerEvent(Constants.EventNames.TAP); } }