private AppInterface.TouchData CreateTouchEventData(TouchInputEvent inputEvent) { var result = new AppInterface.TouchData(); result.point.Set(inputEvent.pointerEvents[0].x, inputEvent.pointerEvents[0].y); return(result); }
protected override void OnTouchStart(TouchInputEvent input) { if (_canMove) { _inputActive = true; } }
protected override void OnTouchStart(TouchInputEvent input) { if (GameManager.Instance.CurrentState != GameState.Playing) { return; } _tapTime = Time.time; }
protected override void OnTouchStay(TouchInputEvent input) { // The player can't move if an ability is currently being used if (GameManager.Instance.CurrentState != GameState.Playing || (_activeAbility != null && _activeAbility.enabled)) { return; } CurrentAngle += Mathf.Clamp(input.touchDelta.x, -45, 45) * MovementModifier; Pivot.localRotation = Quaternion.Euler(0, 0, CurrentAngle); }
protected override void OnTouchRelease(TouchInputEvent input) { if (GameManager.Instance.CurrentState != GameState.Playing) { return; } if (_activeAbility != null) { _activeAbility.enabled = (Time.time - _tapTime < _tapMaxTime); } }
bool HandleTouchInput() { var touchPointerEvents = new List <TouchInputPointerEvent>(m_inputFrame.Touches.Length); bool anyTouchesDown = false; bool anyTouchesUp = false; foreach (var touch in m_inputFrame.Touches) { if (ShouldConsumeTouch(touch.fingerId)) { if (touch.phase == TouchPhase.Began) { anyTouchesDown = true; } else if (touch.phase == TouchPhase.Ended) { anyTouchesUp = true; } touchPointerEvents.Add(new TouchInputPointerEvent { x = TranslateGlobalXToLocalX(touch.position.x), y = TranslateGlobalYToLocalY(touch.position.y), pointerIdentity = touch.fingerId, pointerIndex = touchPointerEvents.Count }); } } int touchEventIndex = 0; foreach (var touchPointerEvent in touchPointerEvents) { var touchEvent = new TouchInputEvent(anyTouchesUp, anyTouchesDown, touchEventIndex, touchPointerEvent.pointerIdentity); touchEvent.pointerEvents = touchPointerEvents; m_touchInputProcessor.HandleInput(touchEvent); ++touchEventIndex; } bool hasProcessedTouches = touchEventIndex > 0; return(hasProcessedTouches); }
void HandleTouchInput() { var touches = m_inputFrame.Touches; var anyTouchesDown = touches.Any(_t => _t.phase == TouchPhase.Began); var anyTouchesUp = touches.Any(_t => _t.phase == TouchPhase.Ended); int index = 0; foreach (var provokingTouch in touches) { var touchEvent = new TouchInputEvent(anyTouchesUp, anyTouchesDown, index++, provokingTouch.fingerId); touchEvent.pointerEvents.AddRange(touches.Select((_t, _i) => new TouchInputPointerEvent { x = _t.position.x, y = _t.position.y, pointerIdentity = _t.fingerId, pointerIndex = _i })); m_inputProcessor.HandleInput(touchEvent); } }
bool HandleTouchInput() { var touches = m_inputFrame.Touches; var anyTouchesDown = touches.Any(_t => _t.phase == TouchPhase.Began) && m_inputFrame.ShouldHandleEventsThisFrame; var anyTouchesUp = touches.Any(_t => _t.phase == TouchPhase.Ended); int index = 0; foreach (var provokingTouch in touches) { var touchEvent = new TouchInputEvent(anyTouchesUp, anyTouchesDown, index++, provokingTouch.fingerId); touchEvent.pointerEvents.AddRange(touches.Select((_t, _i) => new TouchInputPointerEvent { x = TranslateGlobalXToLocalX(_t.position.x), y = TranslateGlobalYToLocalY(_t.position.y), pointerIdentity = _t.fingerId, pointerIndex = _i })); m_touchInputProcessor.HandleInput(touchEvent); } return(touches.Length > 0); }
public void HandleInput(TouchInputEvent inputEvent) { }
public void PointerMove(TouchInputEvent inputEvent) { m_handler.Event_TouchMove(CreateTouchEventData(inputEvent)); }
public void PointerDown(TouchInputEvent inputEvent) { m_handler.Event_TouchDown(CreateTouchEventData(inputEvent)); }
protected override void OnTouchRelease(TouchInputEvent input) { _inputActive = false; }
private void HandleTouchEvents(object sender, TouchInputEvent e) { // These cases are not handled }