// Update is called once per frame void Update() { if (controller.IsConnected) { Frame frame = controller.Frame(); if (frame.Hands.Count > 0) { Hand hand = frame.Hands[0]; if (hand.Fingers.Count >= 3) { if (!start) { calcKoefSize(hand); reactivateRunnerCursor(true); startRunnerCursor(hand); } else { if (detectClick(hand.PalmPosition, hand.Fingers[1].TipPosition, 75)) { shipController.attack(); } if (detectClick(hand.PalmPosition, hand.Fingers[2].TipPosition, 75)) { shipController.setRotNor_hand(true); } //shipController.editSpeedTarget(getDistance(hand.Fingers[0].TipPosition, hand.Fingers[hand.Fingers.Count-1].TipPosition)); calcDelta(hand); } } } else { reactivateRunnerCursor(false); runnerSceneCtrl.timerStart_Restart(); } } }
private void startRunnerCursor() { //Debug.Log(posHandRight + " PHR"); Vector2 posHand = Input.mousePosition; posHand.x -= Screen.width / 2; posHand.y -= Screen.height / 2; //Debug.Log(posHand + " PH"); uiElement.setPosRunnerCursor(posHand, 0); //float dir = -hand.Direction.x*Mathf.Rad2Deg; //uiElement.setRotRunnerCursor(dir, 0); if (Mathf.Abs(posHand.x) < 50 /* && Mathf.Abs(posHand.y) < 50*/) { runnerSceneCtrl.timerStart_Counter(); } else { runnerSceneCtrl.timerStart_Restart(); } }