Exemple #1
0
        public Breakout(IGameLoop gameLoop, IGraphics graphics, IAudio audio, IKeyboard keyboard, IFileSystem fileSystem) : base(nameof(Breakout), gameLoop, graphics, audio, keyboard, null, fileSystem)
        {
            Keyboard = new StatefulKeyboard(keyboard);

            // the state machine we'll be using to transition between various states
            // in our game instead of clumping them together in our update and draw
            // methods
            //
            // our current game state can be any of the following:
            // 1. 'start' (the beginning of the game, where we're told to press Enter)
            // 2. 'paddle-select' (where we get to choose the color of our paddle)
            // 3. 'serve' (waiting on a key press to serve the ball)
            // 4. 'play' (the ball is in play, bouncing between paddles)
            // 5. 'victory' (the current level is over, with a victory jingle)
            // 6. 'game-over' (the player has lost; display score and allow restart)
            StateMachine = new StateMachine(new Dictionary <string, State>
            {
                ["start"]            = new StartState(),
                ["play"]             = new PlayState(),
                ["serve"]            = new ServeState(),
                ["game-over"]        = new GameOverState(),
                ["victory"]          = new VictoryState(),
                ["high-scores"]      = new HighScoreState(),
                ["enter-high-score"] = new EnterHighScoreState(),
                ["paddle-select"]    = new PaddleSelectState(),
            });

            Instance = this;
        }
Exemple #2
0
        public FiftyBird(IGameLoop gameLoop, IGraphics graphics, IAudio audio, IKeyboard keyboard, IMouse mouse) : base(nameof(FiftyBird), gameLoop, graphics, audio, keyboard, mouse)
        {
            Keyboard = new StatefulKeyboard(keyboard);
            Mouse    = new StatefulMouse(mouse);

            // initialize state machine with all state - returning functions
            StateMachine = new StateMachine(new Dictionary <string, State>
            {
                ["title"]     = new TitleScreenState(),
                ["countdown"] = new CountdownState(),
                ["play"]      = new PlayState(),
                ["score"]     = new ScoreState()
            });

            Instance = this;
        }
Exemple #3
0
        public LegendOf50(IGameLoop gameLoop, IGraphics graphics, IAudio audio, IKeyboard keyboard, IMouse mouse = null, IFileSystem fileSystem = null) : base(nameof(LegendOf50), gameLoop, graphics, audio, keyboard, mouse, fileSystem)
        {
            Keyboard = new StatefulKeyboard(keyboard);

            Instance = this;
        }