Ejemplo n.º 1
0
    void MoveIndicator()
    {
        //first check whether the current state is equal to the MoveIndicator state
        //if not, return;

        //log a message to the console of the current state you are in
        //if you press a certain key, switch state to the next state

        //create an additional two states along with two matching methods

        if (stateHandler.currentState != moveIndicator)
        {
            return;
        }


        Debug.Log("In move indicator");
        //if (TrackGestures.GetGesture(MLHands.Right, MLHandKeyPose.Thumb))
        //{
        //    InstantiateObject(MLHands.Right.Center, indicatorPrefab);
        //}

        //else if some gesture = specify hand and specify the thumb pose (left hand)
        //spawn the indicator prefab

        //if (TrackGestures.GetGesture(MLHands.Left, MLHandKeyPose.Thumb))
        //{
        //    InstantiateObject(MLHands.Left.Center, indicatorPrefab);
        //}

        // check if the we're using the left hand and finger  gesture
        //Current indicator  position = the gesture position

        //do the same with the left hand and finger gesture
        if (TrackGestures.GetGesture(MLHands.Left, MLHandKeyPose.Finger))
        {
            currentIndicator.position = MoveObjectWithGesture.MoveObjectToPosition(MLHands.Left);
        }
        else if (TrackGestures.GetGesture(MLHands.Right, MLHandKeyPose.Finger))
        {
            currentIndicator.position = MoveObjectWithGesture.MoveObjectToPosition(MLHands.Right);
        }

        if (eyeTracker.IsBlinking() && TrackGestures.GetGesture(MLHands.Right, MLHandKeyPose.Thumb))
        {
            currentIndicator.gameObject.SetActive(false);
            currentObject    = Instantiate(objectToSpawn, currentIndicator.position, Quaternion.identity);
            currentIndicator = null;
            stateHandler.SwitchToNextState();
        }


        // nothing should happen unless the state is the Move idicator state
        // we want to check is the current state is the Move Indicator state (if it is, continue on in this method)

        //if a gesture is recognized, do the code below
        // write some code that will allow
    }
Ejemplo n.º 2
0
 private void MoveSpawnedObject()
 {
     if ((stateHandler.currentState == spawnObjectState || stateHandler.currentState == moveObjectState))
     {
         if (TrackGestures.GetGesture(MLHands.Right, MLHandKeyPose.Pinch))
         {
             currentObject.position = MoveObjectWithGesture.MoveObjectBetweenTwoFingers(MLHands.Right);
         }
         else if (TrackGestures.GetGesture(MLHands.Left, MLHandKeyPose.Pinch))
         {
             currentObject.position = MoveObjectWithGesture.MoveObjectBetweenTwoFingers(MLHands.Left);
         }
     }
 }