public bool PollInput(BitsyInput.InputId id)
        {
            switch (id)
            {
            case BitsyInput.InputId.Any:
                return(Input.GetButton(ActionButton) || Mathf.Abs(Input.GetAxis(HorizontalAxis)) > 0.5f || Mathf.Abs(Input.GetAxis(VerticalAxis)) > 0.5f);

            case BitsyInput.InputId.Up:
                return(Input.GetAxis(VerticalAxis) > 0.5f);

            case BitsyInput.InputId.Right:
                return(Input.GetAxis(HorizontalAxis) > 0.5f);

            case BitsyInput.InputId.Down:
                return(Input.GetAxis(VerticalAxis) < -0.5f);

            case BitsyInput.InputId.Left:
                return(Input.GetAxis(HorizontalAxis) < -0.5f);

            case BitsyInput.InputId.Action:
                return(Input.GetButton(ActionButton));

            default:
                return(false);
            }
        }
Exemple #2
0
        public static bool GetInputWASD(BitsyInput.InputId id)
        {
            switch (id)
            {
            case BitsyInput.InputId.Any:
                return(Input.anyKey);

            case BitsyInput.InputId.Up:
                return(Input.GetKey(KeyCode.W));

            case BitsyInput.InputId.Right:
                return(Input.GetKey(KeyCode.D));

            case BitsyInput.InputId.Down:
                return(Input.GetKey(KeyCode.S));

            case BitsyInput.InputId.Left:
                return(Input.GetKey(KeyCode.A));

            case BitsyInput.InputId.Action:
                return(Input.GetKey(KeyCode.Space) || Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter));

            default:
                return(false);
            }
        }
Exemple #3
0
 private bool HanldeBitsyInput(BitsyInput.InputId id)
 {
     if (_input != null)
     {
         return(_input.PollInput(id));
     }
     else
     {
         return(BitsyUnityUtils.GetInputWASD(id));
     }
 }