コード例 #1
0
        private ScrollerBinds(ScrollerPlayer player)
        {
            this._Player = player;
            //TODO: will need to create code to manage multiple players.
            switch (_Player.Index)
            {
            case 1:
                //Add 'controls' here.
                _Player.InputManager.Assign(c => MovePlayer(c, Direction.Left), true, new InputButton(Keys.Left));
                _Player.InputManager.Assign(c => MovePlayer(c, Direction.Right), true, new InputButton(Keys.Right));
                _Player.InputManager.Assign(c => JumpPlayer(c, false), false, new InputButton(Keys.Up));
                //_Player.InputManager.Assign(c => CrouchPlayer(c), true, new InputButton(Keys.Down));
                _Player.InputManager.Assign(c => Pause(c), false, new InputButton(Keys.RightShift));
                //_Player.InputManager.Assign(c => ShootPlayer(c), false, new InputButton(Keys.Space));
                break;

            case 2:
                _Player.InputManager.Assign(c => MovePlayer(c, Direction.Left), true, new InputButton(Keys.A));
                _Player.InputManager.Assign(c => MovePlayer(c, Direction.Right), true, new InputButton(Keys.D));
                _Player.InputManager.Assign(c => JumpPlayer(c, false), false, new InputButton(Keys.W));
                //_Player.InputManager.Assign(c => CrouchPlayer(c), true, new InputButton(Keys.S));
                _Player.InputManager.Assign(c => Pause(c), false, new InputButton(Keys.E));
                //_Player.InputManager.Assign(c => ShootPlayer(c), false, new InputButton(Keys.C));
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Creates a new player.
        /// </summary>
        public ScrollerPlayer CreateNewPlayer()
        {
            var            playerEntity = ScrollerPlayer.LoadPlayerEntity();
            ScrollerPlayer player       = new ScrollerPlayer(playerEntity);

            this.AddPlayer(player);
            ScrollerBinds.CreateBinds(player);
            return(player);
        }
コード例 #3
0
 /// <summary>
 /// Creates and returns the binds for the specified player.
 /// </summary>
 public static void CreateBinds(ScrollerPlayer player)
 {
     var binds = new ScrollerBinds(player);
 }