示例#1
0
        public override void Process()
        {
            if (active)
            {
                bool up   = KeyMapper.GetAxis("Vertical") > 0;
                bool down = KeyMapper.GetAxis("Vertical") < 0;

                bool select = KeyMapper.GetButtonDown("Jump") || Input.GetKeyDown(KeyCode.Return);

                if (canMove >= 20)
                {
                    if (up)
                    {
                        selectedButton = (selectedButton + buttons.Length - 1) % buttons.Length;
                        canMove        = 0;
                    }
                    if (down)
                    {
                        selectedButton = (selectedButton + buttons.Length + 1) % buttons.Length;
                        canMove        = 0;
                    }
                }
                else
                {
                    canMove++;
                }

                eventSystem.SetSelectedGameObject(buttons[selectedButton]);

                if (select)
                {
                    buttons[selectedButton].GetComponent <Button>().onClick.Invoke();
                }
            }
        }
 void FetchControls()
 {
     horizontal = KeyMapper.GetAxis("Horizontal");
     PlayerInstanciationScript.player.direction
         = horizontal > 0
             ? DIRECTION.RIGHT
             : DIRECTION.LEFT;
 }