예제 #1
0
    public void StartNextStep()
    {
        Action <float> gestureNotificationHandler = (float angle) => {
            twistController.UnsubscribeFromTwist(twistSubscriptionID);
            twistSubscriptionID = twistController.SubscribeToTwist(TwistController.Twist.Ending,
                                                                   (float _) =>
            {
                twistController.UnsubscribeFromTwist(twistSubscriptionID);
                StartNextStep();
            });
        };

        currentStage++;
        List <Tuple <TutorialScript.Actions, GameObject> > newPermittedActions = new List <Tuple <TutorialScript.Actions, GameObject> >();

        switch (currentStage)
        {
        case Stages.WaitingForStart:
            break;

        case Stages.Rotation:
            newPermittedActions.Add(new Tuple <TutorialScript.Actions, GameObject>(TutorialScript.Actions.Twist, null));
            permitedActionSetter(newPermittedActions);
            rotationGesture.SetActive(true);
            twistSubscriptionID = twistController.SubscribeToTwist(TwistController.Twist.Twist, gestureNotificationHandler);
            break;

        case Stages.End:
            rotationGesture.SetActive(false);
            permitedActionSetter(newPermittedActions);
            actionOnComplete();
            currentStage = Stages.WaitingForStart;
            break;
        }
    }
예제 #2
0
    public int SubscribeToGesture(Gestures gesture, Action <float> handler)
    {
        int subResult = -1;

        switch (gesture)
        {
        case Gestures.PinchClose:
            subResult = pinchController.SubscribeToPinch(PinchController.Pinch.PinchClose, handler);
            break;

        case Gestures.PinchOpen:
            subResult = pinchController.SubscribeToPinch(PinchController.Pinch.PinchClose, handler);
            break;

        case Gestures.Twist:
            subResult = twistController.SubscribeToTwist(TwistController.Twist.Twist, handler);
            break;

        default:
            break;
        }
        return(subResult);
    }
예제 #3
0
 public void Permit(bool aroundOnly = false)
 {
     isAroundOnlyPermited = aroundOnly;
     if (!isPermited)
     {
         swipeController        = GameObject.Find("Controller").GetComponent <SwipesController>();
         twistController        = GameObject.Find("Controller").GetComponent <TwistController>();
         isPermited             = true;
         swipeDownSubscription  = swipeController.SubscribeToSwipe(SwipesController.Swipe.Down, _SwipeHandler);
         swipeLeftSubscription  = swipeController.SubscribeToSwipe(SwipesController.Swipe.Left, _SwipeHandler);
         swipeRightSubscription = swipeController.SubscribeToSwipe(SwipesController.Swipe.Right, _SwipeHandler);
         swipeUpSubscription    = swipeController.SubscribeToSwipe(SwipesController.Swipe.Up, _SwipeHandler);
         twistSubscription      = twistController.SubscribeToTwist(TwistController.Twist.Twist, _TwistHandler);
     }
 }