protected void UpdateMouse() { if (Input.GetMouseButtonDown(0)) { CreateTouch(Input.mousePosition, 0); } if (mMouseTouch != null) { mMouseTouch.Update(Input.mousePosition, Input.GetMouseButtonUp(0)); if (OnTouchUpdate != null) { OnTouchUpdate(mMouseTouch); } if (mMouseTouch.isTap) { HandleTap(mMouseTouch); } if (mMouseTouch.isSwipe) { HandleSwipe(mMouseTouch); } if (mMouseTouch.isDead) { DestroyTouch(mMouseTouch); mMouseTouch = null; return; } } }
protected void UpdateMouse() { if (inputEnabled && UnityEngine.Input.GetMouseButtonDown(0)) { CreateTouch(UnityEngine.Input.mousePosition, 0); } if (mouseTouch != null) { if (!inputEnabled) { mouseTouch.Update(UnityEngine.Input.mousePosition, true); } else { mouseTouch.Update(UnityEngine.Input.mousePosition, UnityEngine.Input.GetMouseButtonUp(0)); } if (TouchUpdate != null) { TouchUpdate(mouseTouch); } if (mouseTouch.IsTap) { HandleTap(mouseTouch); } if (mouseTouch.IsSwipe) { HandleSwipe(mouseTouch); } if (mouseTouch.IsDead) { DestroyTouch(mouseTouch); mouseTouch = null; return; } } }
protected void UpdateTouch(Touch touchInfo) { TouchInformation ti = GetTouch(touchInfo); if (touchInfo.phase == TouchPhase.Began) { if (ti != null) { // Touch was started twice; weird! Bug? ti.phase = TouchPhase.Canceled; DestroyTouch(ti); } CreateTouch(touchInfo); return; } if (ti != null) { ti.Update(touchInfo); if (!inputEnabled) { ti.phase = TouchPhase.Canceled; } if (TouchUpdate != null) { TouchUpdate(ti); } } if (ti.IsTap) { HandleTap(ti); } if (ti.IsSwipe) { HandleSwipe(ti); } if (ti.IsDead) { DestroyTouch(ti); return; } }