//*************************************** // ContinueGesture // // use: Update min and max x and y values for // the current gesture being recorded // and add the new point to the list. // Called while player holds input down. private void ContinueGesture() { currentPoint.SetX(Input.mousePosition.x - startPoint.GetX()); currentPoint.SetY(Input.mousePosition.y - startPoint.GetY()); currentPointList.Add(new TwoDPoint(currentPoint.GetX(), currentPoint.GetY())); if (currentPoint.GetX() > currentGesture.GetMaxX()) { currentGesture.SetMaxX(currentPoint.GetX()); } if (currentPoint.GetX() < currentGesture.GetMinX()) { currentGesture.SetMinX(currentPoint.GetX()); } if (currentPoint.GetY() > currentGesture.GetMaxY()) { currentGesture.SetMaxY(currentPoint.GetY()); } if (currentPoint.GetY() < currentGesture.GetMinY()) { currentGesture.SetMinY(currentPoint.GetY()); } if (limitSamples && currentPointList.Count >= maxPointsAllowed) { gestureComplete = true; Debug.Log(message: "Gesture Complete!"); } }
//*************************************** // StartGesture // // use: Set up recording of gesture by // setting the start point and control bool. // Called when player first clicks. private void StartGesture() { Debug.Log("gesture started"); startPoint.SetX(Input.mousePosition.x); startPoint.SetY(Input.mousePosition.y); gestureComplete = false; }