Exemplo n.º 1
0
 private void FireOnStateExited(InteractionStateEnum state)
 {
     if (OnStateExited != null)
     {
         OnStateExited(state);
     }
 }
Exemplo n.º 2
0
        protected override void OnStateHandled(InteractionStateEnum state)
        {
            switch (state)
            {
            case InteractionStateEnum.DragBegin:
                FireOnButtonDragBegin(LastEventData);
                break;

            case InteractionStateEnum.Drag:
                FireOnButtonDrag(LastEventData);
                break;

            case InteractionStateEnum.DragEnd:
                FireOnButtonDragEnd(LastEventData);
                break;
            }

            base.OnStateHandled(state);
        }
Exemplo n.º 3
0
        private void ChangeStateTo(InteractionStateEnum state)
        {
            float stateEnterTime = CurState == null ? Time.realtimeSinceStartup : CurState.StateEnterTime;

            if (CurState != null)
            {
                CurState.ExitStateHandler();
            }

            CurState = FindState(state);

            if (CurState == null)
            {
                Debug.LogWarning("CurState is null");
                return;
            }

            CurState.EnterStateHandler(stateEnterTime);

            CurState.StateHandler();
        }
Exemplo n.º 4
0
        protected virtual void OnStateHandled(InteractionStateEnum state)
        {
            switch (state)
            {
            case InteractionStateEnum.DoubleTap:
                FireOnButtonDoubleTap(LastEventData);
                break;

            case InteractionStateEnum.Tap:
                FireOnButtonTap(LastEventData);
                break;

            case InteractionStateEnum.Press:
                FireOnButtonPress(LastEventData);
                break;

            case InteractionStateEnum.PressDown:
                FireOnButtonPressDown(LastEventData);
                break;

            case InteractionStateEnum.TapAndHoldPressUp:
            case InteractionStateEnum.PressUp:
                if (_isExitedWhilePressed)
                {
                    _isExitedWhilePressed = false;

                    FireOnInputLeftButton(LastEventData);

                    break;
                }

                FireOnButtonPressUp(LastEventData);
                break;

            case InteractionStateEnum.TapAndHold:
                FireOnTapAndHold(LastEventData);
                break;
            }
        }
Exemplo n.º 5
0
        protected virtual void OnStateHandled(InteractionStateEnum state)
        {
            switch (state)
            {
            case InteractionStateEnum.DoubleTap:
                FireOnButtonDoubleTap(LastEventData);
                break;

            case InteractionStateEnum.Tap:
                FireOnButtonTap(LastEventData);
                break;

            case InteractionStateEnum.Press:
                FireOnButtonPress(LastEventData);
                break;

            case InteractionStateEnum.PressDown:
                FireOnButtonPressDown(LastEventData);
                break;

            case InteractionStateEnum.TapAndHoldPressUp:
            case InteractionStateEnum.PressUp:
                GameObject targetObjectOnPointer = MMStandaloneInputModule.CurrentInput.GameObjectUnderPointer();
                if (targetObjectOnPointer == null || (targetObjectOnPointer != this && !targetObjectOnPointer.transform.IsChildOf(transform)))
                {
                    FireOnInputLeftButton(LastEventData);

                    break;
                }

                FireOnButtonPressUp(LastEventData);
                break;

            case InteractionStateEnum.TapAndHold:
                FireOnTapAndHold(LastEventData);
                break;
            }
        }
Exemplo n.º 6
0
 private Transition FindTransition(InteractionStateEnum state, CommandEnum command)
 {
     return(StateTransitions.Find(tr => tr.CurState == state && tr.Command == command));
 }
Exemplo n.º 7
0
 private StateBase FindState(InteractionStateEnum state)
 {
     return(States.Find(s => s.StateEnum == state));
 }
Exemplo n.º 8
0
 protected virtual void OnStateExited(InteractionStateEnum state)
 {
 }
 public StateDatum(InteractionStateEnum state)
 {
     this.InteractionState = state; this.Name = state.ToString();
 }
Exemplo n.º 10
0
 public Transition(InteractionStateEnum curState, CommandEnum command, InteractionStateEnum outcomeState)
 {
     CurState     = curState;
     Command      = command;
     OutcomeState = outcomeState;
 }