private void OnFingerDown(Lean.Touch.LeanFinger finger) { if (curr_finger == null) { curr_finger = finger; } }
public void OnFingerSet(Lean.Touch.LeanFinger finger) { if (useInput == false) { return; } if (playerInput == null) { return; } if (inGameCamera == null) { inGameCamera = GameManager.Instance.cameraManager.GetCamera(); } Vector3 playerPos = playerInput.transform.position; Vector3 fingerPos = finger.GetWorldPosition(Vector3.Distance(playerPos, inGameCamera.transform.position), inGameCamera); Vector3 dir = (fingerPos - playerPos); playerInput.AddDirection(dir); if (OnFingerSetAction != null) { OnFingerSetAction.Invoke(); } }
private void OnFingerUp(Lean.Touch.LeanFinger finger) { if (finger == curr_finger) { curr_finger = null; } }
private void OnFingerDown(Lean.Touch.LeanFinger finger) { if (finger.Index == 0 && hasAuthority) { trackFinger = finger; fingerDown = true; } }
private void OnFingerUp(Lean.Touch.LeanFinger finger) { if (finger.Index == 0 && hasAuthority) { fingerDown = false; trackFinger = null; } }
private bool IgnoreInput(Lean.Touch.LeanFinger finger) { //if input does not belong to filter if (!this.InputFilter.GetFingers().Contains(finger)) { return(true); } return(false); }
private void onFingerDown(Lean.Touch.LeanFinger finger) { //Debug.Log("Finger down event"); if (Lean.Touch.LeanTouch.Fingers.Count > 1) { //Debug.Log("Multiple Fingers Down - Clear Lines"); detector.ClearLines(); } }
public void SetActive(Lean.Touch.LeanFinger finger, PlayerEntity curPlayer) { if (_activeObject != null) { Destroy(_activeObject); } _activeObject = null; curPlayer.ActivateSpecialPower(_type.Type); }
private void SelectionLock(Lean.Touch.LeanFinger finger) { if (this.IgnoreInput(finger)) { return; } //force update before locking this.Update(); this.SelectionLocked = true; }
void OnFingerUp(Lean.Touch.LeanFinger finger) { if (finger.Index == 0) { _dragFinger = null; if (_dragTiles != null) { if (_dragTiles.Count >= 3) { Combo(); } _dragTiles.Clear(); _line.positionCount = 0; } if (_selectedUI != null) { if (_selectedUI.name.Contains("Color")) { //_selectedUI.GetComponent<SpecialPowerUI>().Fly(); if (_selectedUI.GetComponent <SpecialPowerUI>().Type == TileTypes.ESubState.blue || _selectedUI.GetComponent <SpecialPowerUI>().Type == TileTypes.ESubState.green) { RootController.Instance.GetCurrentPlayer().EmptyPower(_selectedUI.GetComponent <SpecialPowerUI>().Type); } } _selectedUI = null; } } if (finger.Index == 1) { if (_selectedUI2 != null) { //_selectedUI2.GetComponent<SpecialPowerUI>().Fly(); _selectedUI2 = null; } } if (_gridController) { foreach (HexTile tile in _gridController.AllTilesAsHexTile()) { tile.selected = false; } if (RootController.Instance.GetMyPlayerEntity()) { RootController.Instance.GetMyPlayerEntity().ClearSelectionData(); } } }
private void SwipeHappened(Lean.Touch.LeanFinger finger) { if (finger.SwipeScaledDelta.x > 0) //Swipe Right { fingerMovement += 1; } else if (finger.SwipeScaledDelta.x < 0) //Swipe Left { fingerMovement -= 1; } }
void PassTurn() { _curPlayer.Heal(5); _dragFinger = null; if (_dragTiles != null) { _dragTiles.Clear(); _line.positionCount = 0; } EndTurn(); }
public void GoThere(Lean.Touch.LeanFinger finger) { float dist = (camera.transform.position - transform.position).magnitude; var ray = finger.GetRay(camera); Vector3 touchWorldPos = finger.GetWorldPosition(dist); //Debug.Log("Go there, Actual pos is " + touchWorldPos); touchWorldPos.y = 2; transform.position += (touchWorldPos - transform.position).normalized * speed * Time.deltaTime; }
private void CheckOnFingerDistance() { if (curr_finger != null) { Vector2 start = curr_finger.StartScreenPosition; Vector2 curr = curr_finger.ScreenPosition; if (Mathf.Abs(Vector2.Distance(start, curr)) > 40) { OnFingerSwipe(curr_finger); Debug.Log("swiped"); curr_finger = null; } } }
void OnFingerUp(Lean.Touch.LeanFinger finger) { if (finger.Index == 0) { _dragFinger = null; if (_dragTiles != null) { if (_dragTiles.Count >= 3) { Combo(); } _dragTiles.Clear(); _line.positionCount = 0; } if (_selectedUI != null) { if (_selectedUI.name.Contains("Color")) { _selectedUI.GetComponent <SpecialPowerUI>().Fly(); } _selectedUI = null; } } if (finger.Index == 1) { if (_selectedUI2 != null) { _selectedUI2.GetComponent <SpecialPowerUI>().Fly(); _selectedUI2 = null; } } if (_gridController) { foreach (HexTile tile in _gridController.AllTilesAsHexTile()) { tile.selected = false; } } }
public void SetActive(Lean.Touch.LeanFinger finger, Player curPlayer) { if (_activeObject != null) { Destroy(_activeObject); } _activeObject = null; _active = true; _finger = finger; if (_type.Type == TileTypes.ESubState.red) { _activeObject = Instantiate(Resources.Load <GameObject>("SpecialSelect")); } else if (_type.Type == TileTypes.ESubState.yellow) { _activeObject = Instantiate(Resources.Load <GameObject>("YellowSpecial")); } else if (_type.Type == TileTypes.ESubState.blue) { curPlayer.BlueTileEffect(); //Shield } else if (_type.Type == TileTypes.ESubState.green) { curPlayer.GreenTileEffect(); } if (_activeObject != null) { _activeObject.name = "SpecialSelect"; _activeObject.transform.SetParent(this.transform.parent.parent, false); _activeObject.GetComponent <MissileUI>().target = RootController.Instance.NextPlayer(curPlayer.playerNumber); _activeObject.GetComponent <MissileUI>().Type = _type.Type; _curPos = _finger.GetWorldPosition(1f, Camera.current); _lastPos = _finger.GetWorldPosition(1f, Camera.current); } }
private void SelectionUnlock(Lean.Touch.LeanFinger finger) { this.SelectionLocked = false; }
private void FingerUp(Lean.Touch.LeanFinger finger) { isOn = false; }
private void FingerDown(Lean.Touch.LeanFinger finger) { isOn = true; }
void idk(Lean.Touch.LeanFinger finger) { /* Workaround for now * This is to prevent finger touch to "bleed" through the finish button and prevent unintentional drawing * TODO: Refactor variable names */ var test = Lean.Touch.LeanTouch.RaycastGui(finger.ScreenPosition); if (test.Count > 0) { var idk1 = test[0]; if (idk1.gameObject.name == "RecognizeButtonText") { //Debug.Log("Clicked on button: " + idk1.gameObject.name); return; } } //No way to specify the GUI we want :/ bummer if (finger.IsOverGui) { //Started pressing this frame if (finger.Down) { if (recognized) { recognized = false; } strokeID++; Transform tmpGesture = Instantiate(GesturePrefab, Vector3.zero, Quaternion.identity) as Transform; currentGestureLineRenderer = tmpGesture.GetComponent <UILineRendererList>(); //Set the parent currentGestureLineRenderer.transform.SetParent(DrawingLinesParent.transform); //TODO: better this out //Remember to set the rect transform in the proper position (bottom left) currentGestureLineRenderer.transform.GetComponent <RectTransform>().anchorMin = new Vector2(0, 0); currentGestureLineRenderer.transform.GetComponent <RectTransform>().anchorMax = new Vector2(0, 0); currentGestureLineRenderer.transform.GetComponent <RectTransform>().pivot = new Vector2(0, 0); gestureLinesRenderer.Add(currentGestureLineRenderer); } else if (finger.IsActive) { points.Add(new Point(finger.ScreenPosition.x, -finger.ScreenPosition.y, strokeID)); var point = new Vector2() { x = finger.ScreenPosition.x, y = finger.ScreenPosition.y }; currentGestureLineRenderer.AddPoint(point); //currentGestureLineRenderer.SetAllDirty(); //currentGestureLineRenderer.SetPosition(currentGestureLineRenderer.positionCount - 1, Camera.main.ScreenToWorldPoint(new Vector3(info.ScreenPosition.x, info.ScreenPosition.y, 10))); } } }
private void LeanTouch_OnFingerUp(Lean.Touch.LeanFinger obj) { this.IsHoldingDown = false; }
private void LeanTouch_OnFingerDown(Lean.Touch.LeanFinger obj) { this.IsHoldingDown = true; }
private void LeanTouch_OnFingerTap(Lean.Touch.LeanFinger obj) { //this.ball.AddTorque(); }
public void Beg(Lean.Touch.LeanFinger finger) { Run = true; }
void HandleFingerTap(Lean.Touch.LeanFinger finger) { }
private void OnFingerSwipe(Lean.Touch.LeanFinger finger) { float angle_threshold = 90; float up_angle = 0.0f; float right_angle = 90.0f; float down_angle = 180.0f; float left_angle = 270.0f; bool up = false; bool right = false; bool down = false; bool left = false; if (finger.StartedOverGui == true) { return; } Vector2 swipeDelta = finger.SwipeScreenDelta; // Invalid angle? float angle = Mathf.Atan2(swipeDelta.x, swipeDelta.y) * Mathf.Rad2Deg; // up float delta = Mathf.DeltaAngle(angle, up_angle); if (delta >= angle_threshold * -0.5f && delta < angle_threshold * 0.5f) { up = true; } // right delta = Mathf.DeltaAngle(angle, right_angle); if (delta >= angle_threshold * -0.5f && delta < angle_threshold * 0.5f) { right = true; } // down delta = Mathf.DeltaAngle(angle, down_angle); if (delta >= angle_threshold * -0.5f && delta < angle_threshold * 0.5f) { down = true; } // left delta = Mathf.DeltaAngle(angle, left_angle); if (delta >= angle_threshold * -0.5f && delta < angle_threshold * 0.5f) { left = true; } if (up) { OnSwipeUp(); } if (right) { OnSwipeRight(); } if (down) { OnSwipeDown(); } if (left) { OnSwipeLeft(); } }
private void Paint(LeanFinger finger) { // If we require a selectable and it isn't selected, cancel if (RequiredSelectable != null && RequiredSelectable.IsSelected == false) { return; } // Make sure the mesh filter and mesh exist if (cachedMeshFilter == null) { cachedMeshFilter = GetComponent <MeshFilter>(); } if (cachedMeshFilter.sharedMesh != null) { // Duplicate mesh? if (modifiedMesh == null) { modifiedMesh = cachedMeshFilter.sharedMesh = Instantiate(cachedMeshFilter.sharedMesh); } // Duplicate indices and colors? if (modifiedColors == null || modifiedColors.Length != modifiedMesh.vertexCount) { modifiedIndices = modifiedMesh.triangles; modifiedColors = modifiedMesh.colors; // If the mesh has no vertex colors, make some if (modifiedColors == null || modifiedColors.Length == 0) { modifiedColors = new Color[modifiedMesh.vertexCount]; for (var i = modifiedMesh.vertexCount - 1; i >= 0; i--) { modifiedColors[i] = Color.white; } } } // Raycast under the finger and paint the hit triangle var hit = default(RaycastHit); if (Physics.Raycast(finger.GetRay(Camera), out hit) == true) { if (hit.collider.gameObject == gameObject) { var index = hit.triangleIndex * 3; var a = modifiedIndices[index + 0]; var b = modifiedIndices[index + 1]; var c = modifiedIndices[index + 2]; modifiedColors[a] = Color.black; modifiedColors[b] = Color.black; modifiedColors[c] = Color.black; modifiedMesh.colors = modifiedColors; } } } }
/// <summary>If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.</summary> public void AddFinger(LeanFinger finger) { Use.AddFinger(finger); }
/// <summary>If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.</summary> public void RemoveFinger(LeanFinger finger) { Use.RemoveFinger(finger); }
// Function OnFingerTap public void OnFingerTap(LeanFinger finger) { SelectObject(finger); }