/// <summary> /// Callback to draw gizmos that are pickable and always drawn. /// </summary> void OnDrawGizmos() { if (fingerID != 0) { Gizmos.DrawWireSphere(transform.position, TouchHelper.GetTouchByFingerID(fingerID).radius); } }
// Use this for initialization public void UpdateFinger() { if (!calledThisFrameYet) { gameObject.name = "Finger - " + fingerID; calledThisFrameYet = true; touchLastFrame = touch; touch = TouchHelper.GetTouchByFingerID(fingerID); Vector3 newPos = TouchHelper.GetTouchWorldPosition(touch); newPos.z = 0f; transform.position = newPos; // determine the 🗾 state if (currentState == TouchState.Tap) { // are we a drag 👑 yet? Vector2 distance = touch.position - originTouch.position; if (distance.magnitude > TouchManager.inst.dragDetectionDistPixels) { currentState = TouchState.Dragging; if (OnStatusChange != null) { OnStatusChange(this); } } } // or are we to 💀 die if (IsFingerLeaving(this)) { currentState = TouchState.Ending; if (OnStatusChange != null) { OnStatusChange(this); } Destroy(this.gameObject); } if (OnFingerUpdated != null) { OnFingerUpdated(this); } } }