예제 #1
0
    protected virtual void OnControllerButtonReleased(InputControlType pButton)
    {
        Debug.LogFormat("Controller button {0} was released", pButton);

        InputAction action = _taskActions.Peek();

        if (pButton == action.controlType)
        {
            if (action.GetType() == typeof(JoystickAction))
            {
                JoystickAction joystickAction = action as JoystickAction;
                Debug.Log("Joystick Task Detected - Released");
            }
            else if (action.GetType() == typeof(ButtonAction))
            {
                ButtonAction btnAction = action as ButtonAction;
                if (btnAction.isHold)
                {
                    _isHoldTimerActive = false;
                    _holdTime          = 0f;
                    _holdTimer         = 0f;

                    // Add a check for holdTimer buffer to see if withing range then deque task
                }
            }
        }

        if (_taskActions.Count == 0)
        {
            Messenger.Broadcast(Messages.MINI_GAME_COMPLETE, true);
        }
    }
예제 #2
0
    /* PRIVATE FUNCTIONS */


    /* EVENT HANDLERS */

    protected virtual void OnControllerButtonPressed(InputControlType pButton)
    {
        Debug.LogFormat("Controller button {0} was pressed", pButton);
        InputAction action = _taskActions.Peek();

        if (pButton == action.controlType)
        {
            if (action.GetType() == typeof(JoystickAction))
            {
                JoystickAction joystickAction = action as JoystickAction;
                Debug.Log("Joystick Task Detected - Pressed");
            }
            else if (action.GetType() == typeof(ButtonAction))
            {
                ButtonAction btnAction = action as ButtonAction;
                if (btnAction.isHold)
                {
                    _isHoldTimerActive = true;
                    _holdTime          = btnAction.holdTime;
                }
            }
        }

        if (_taskActions.Count == 0)
        {
            Messenger.Broadcast(Messages.MINI_GAME_COMPLETE, true);
        }
    }
예제 #3
0
 public void EnrollJoystick(JoystickAction joystickAction)
 {
     if (joystickActions == null)
     {
         joystickActions = new List <JoystickAction>();
     }
     joystickActions.Add(joystickAction);
 }
        private bool Next()
        {
            if (_actionsToConfigure.Count == 0 || _oppositeActions.Count == 0)
                return false;

            CurrentAction = _actionsToConfigure.Dequeue();
            CurrentOppositeAction = _oppositeActions.Dequeue();

            return true;
        }
예제 #5
0
    void SetDirection(JoystickAction joystickAction)
    {
        // velocity always forced to 1f
        // input = new Vector2(
        //   joystickAction.direction.x == 0 ? 0 : Mathf.Sign(joystickAction.direction.x),
        //   joystickAction.direction.y == 0 ? 0 : Mathf.Sign(joystickAction.direction.y)
        // );

        // velocity smoothed to joystick distance
        input = joystickAction.direction;
    }
        private bool Next()
        {
            if (_actionsToConfigure.Count == 0 || _oppositeActions.Count == 0)
            {
                return(false);
            }

            CurrentAction         = _actionsToConfigure.Dequeue();
            CurrentOppositeAction = _oppositeActions.Dequeue();

            return(true);
        }
예제 #7
0
 void SetButtonCDown(JoystickAction joystickAction)
 {
     //Debug.Log("C");
 }
예제 #8
0
 void SetButtonBDown(JoystickAction joystickAction)
 {
     //Debug.Log("B");
     StartCoroutine(Fire());
 }
예제 #9
0
    // Buttons Down

    void SetButtonADown(JoystickAction joystickAction)
    {
        //Debug.Log("A");
        moving = true;
    }
 protected void OnJoystickAction(JoystickActionEventArgs e)
 {
     JoystickAction?.Invoke(this, e);
 }
        void WizardStepCompleted(JoystickAction action, JoystickAction oppositeAction)
        {
            Console.WriteLine("Completed step: " + action + " and " + oppositeAction);

            UpdateLabel(_wizard.CurrentAction);
        }
예제 #12
0
 public JoystickEvent(JoystickAction action, JoystickDirection direction)
 {
     Action    = action;
     Direction = direction;
 }
예제 #13
0
        void WizardStepCompleted(JoystickAction action, JoystickAction oppositeAction)
        {
            Console.WriteLine("Completed step: " + action + " and " + oppositeAction);

            UpdateLabel(_wizard.CurrentAction);
        }
예제 #14
0
 private void UpdateLabel(JoystickAction currentAction)
 {
     Dispatcher.Invoke(new Action(() => WizardInfo.Content = currentAction));
 }
예제 #15
0
    // Buttons Up

    void SetButtonAUp(JoystickAction joystickAction)
    {
        //Debug.Log("A UP");
        moving = false;
    }
예제 #16
0
 void SetButtonCUp(JoystickAction joystickAction)
 {
     //Debug.Log("C UP");
 }
 private void UpdateLabel(JoystickAction currentAction)
 {
     Dispatcher.Invoke(new Action(() => WizardInfo.Content = currentAction));
 }