Exemplo n.º 1
0
 protected Menu(List <MenuItem> _items, IRenderer _renderer) : base()
 {
     Items          = _items;
     P1             = new PlayerInMenu(_items.First());
     P2             = new PlayerInMenu(_items.First());
     m_lastInputsP1 = null;
     m_lastInputsP2 = null;
     StateRenderer  = _renderer;
 }
Exemplo n.º 2
0
        protected void UpdatePlayerSelection(SinglePlayerInputs _inputs, PlayerInMenu _player, SinglePlayerInputs _lastInputs)
        {
            if (_inputs.A && !_lastInputs.A)
            {
                _player.SelectionState = PlayerInMenu.SelectionStates.Confirmed;
            }
            if (_inputs.B && !_lastInputs.B)
            {
                if (_player.SelectionState == PlayerInMenu.SelectionStates.Confirmed)
                {
                    _player.SelectionState = PlayerInMenu.SelectionStates.Pending;
                }
                else if (_player.SelectionState == PlayerInMenu.SelectionStates.Pending)
                {
                    _player.SelectionState = PlayerInMenu.SelectionStates.Cancel;
                }
            }

            if (_player.SelectionState != PlayerInMenu.SelectionStates.Pending)
            {
                return;
            }

            if (_inputs.JoystickDirection == 5 || _inputs.JoystickDirection != _lastInputs.JoystickDirection)
            {
                _player.MoveCooldown = 0;
            }
            else
            {
                _player.MoveCooldown--;
            }
            if (_player.MoveCooldown <= 0 && _inputs.JoystickDirection != 5)
            {
                MenuItem nextSelection = FindNextItemInDirection(_inputs.JoystickDirection, _player.SelectedItem);
                if (nextSelection != null)
                {
                    _player.SelectedItem = nextSelection;
                    _player.MoveCooldown = 10;
                }
            }
        }
Exemplo n.º 3
0
        private Character DetermineSelectedCharacter(PlayerInMenu _player)
        {
            return(GetCharacterFromString(_player.SelectedItem.ItemName));

            throw new Exception("No Character Selected");
        }