Exemplo n.º 1
0
 private void Update()
 {
     if (ButtonMappings.GetButtonDown(Button.Jump))
     {
         StopSequence();
     }
 }
Exemplo n.º 2
0
 public KBMInputMap()
 {
     //TODO setup some temporary mappings, just for testing
     AxisMappings.Add("NavigateX", new AxisMapping(KeyCode.RightArrow, KeyCode.LeftArrow, KeyCode.D, KeyCode.A, MouseAxis.Undefined, false));
     AxisMappings.Add("NavigateY", new AxisMapping(KeyCode.UpArrow, KeyCode.DownArrow, KeyCode.W, KeyCode.S, MouseAxis.Undefined, false));
     ButtonMappings.Add("Submit", new ButtonMapping(KeyCode.Return, KeyCode.Space, KeyCode.E));
     ButtonMappings.Add("Cancel", new ButtonMapping(KeyCode.Escape, KeyCode.Backspace, KeyCode.None));
 }
Exemplo n.º 3
0
 public void Update()
 {
     if (_currentTip != null && ButtonMappings.GetButtonDown(_waitButton))
     {
         _currentTip.SetActive(false);
         _currentTip = null;
     }
 }
Exemplo n.º 4
0
    public bool IsAbilityBeingPressed(Weather ability)
    {
        if (ability == Weather.Wind)
        {
            return(_currentAbility == ability && ButtonMappings.GetButtonDown(Button.AbilityUse));
        }

        return(_isBeingPressed && (_currentAbility == ability));
    }
 public GameController(Guid id, string name)
 {
     this.Id          = id;
     this.Name        = name;
     this.IsConnected = true;
     foreach (var command in EnumHelper.ToList(typeof(GameControllerButtonCommand)))
     {
         ButtonMappings.Add(new GameControllerButtonMapping((GameControllerButtonCommand)command.Key));
     }
     foreach (var command in EnumHelper.ToList(typeof(GameControllerAxisCommand)))
     {
         AxisMappings.Add(new GameControllerAxisMapping((GameControllerAxisCommand)command.Key, false));
     }
 }
        private void HandleCharacterInput()
        {
            var characterInputs = new PlayerCharacterInputs
            {
                // Build the CharacterInputs struct
                MoveAxisForward = ButtonMappings.GetAxisInput(VerticalInput),
                MoveAxisRight   = ButtonMappings.GetAxisInput(HorizontalInput),
                JumpDown        = ButtonMappings.GetButtonDown(Button.Jump),
                //SprintHoldDown = Input.GetButton(SprintInput) || Input.GetKey(KeyCode.JoystickButton2),
            };

            // Apply inputs to character
            Character.SetInputs(ref characterInputs);
        }
Exemplo n.º 7
0
    private void Update()
    {
        // Update active ability
        if (isWindEnabled && ButtonMappings.GetButtonDown(Button.WindActivate))
        {
            ActivateAbility(Weather.Wind);
        }

        if (isRainEnabled && ButtonMappings.GetButtonDown(Button.RainActivate))
        {
            ActivateAbility(Weather.Rain);
        }

        if (isFrostEnabled && ButtonMappings.GetButtonDown(Button.FrostActivate))
        {
            ActivateAbility(Weather.Frost);
        }

        if (isSunEnabled && ButtonMappings.GetButtonDown(Button.SunActivate))
        {
            ActivateAbility(Weather.Sun);
        }


        // Update when the player uses the ability
        bool isPressed = false;

        if (ButtonMappings.GetButtonDown(Button.AbilityUse))
        {
            OnAbilityDown(_currentAbility);
            isPressed = true;
        }

        if (ButtonMappings.GetButton(Button.AbilityUse))
        {
            OnAbility(_currentAbility);
            isPressed = true;
        }

        if (ButtonMappings.GetButtonUp(Button.AbilityUse))
        {
            OnAbilityUp(_currentAbility);
            isPressed = true;
        }

        _isBeingPressed = isPressed;
    }
        private void Deserialized(StreamingContext context)
        {
            foreach (var command in EnumHelper.ToList(typeof(GameControllerButtonCommand)))
            {
                if (!ButtonMappings.Any(m => m.Command == (GameControllerButtonCommand)command.Key))
                {
                    ButtonMappings.Add(new GameControllerButtonMapping((GameControllerButtonCommand)command.Key));
                }
            }

            foreach (var command in EnumHelper.ToList(typeof(GameControllerAxisCommand)))
            {
                if (!AxisMappings.Any(m => m.Command == (GameControllerAxisCommand)command.Key))
                {
                    AxisMappings.Add(new GameControllerAxisMapping((GameControllerAxisCommand)command.Key, false));
                }
            }
        }
Exemplo n.º 9
0
    void Update()
    {
        if (_canPause && ButtonMappings.GetButtonDown(AWeatheryJourney.Button.Pause))
        {
            if (_gameIsPaused)
            {
                ResumeGame();
            }
            else
            {
                PauseGame();
            }
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Cursor.visible = true;
        }
        if (!_gameIsPaused && Input.GetKeyDown(KeyCode.Mouse0))
        {
            Cursor.visible = false;
        }
    }