Exemplo n.º 1
0
        /// <summary>
        /// Constructor for Game class
        /// </summary>
        public Game()
        {
            win       = new Window("Galaga", 500, 500);
            gameTimer = new GameTimer(60, 60);


            eventBus = GalagaBus.GetBus();
            eventBus.InitializeEventBus(new List <GameEventType> {
                GameEventType.InputEvent,  // key press / key release
                GameEventType.WindowEvent, // messages to the window
                GameEventType.PlayerEvent,
                GameEventType.GameStateEvent
            });
            win.RegisterEventBus(eventBus);
            eventBus.Subscribe(GameEventType.WindowEvent, this);
            stateMachine = new StateMachine();
        }
Exemplo n.º 2
0
 public Game()
 {
     win       = new Window("test", 500, 500);
     gameTimer = new GameTimer(60, 60);
     GalagaBus.GetBus().InitializeEventBus(new List <GameEventType>()
     {
         GameEventType.InputEvent,
         GameEventType.WindowEvent,
         GameEventType.GameStateEvent,
         GameEventType.PlayerEvent
     });
     win.RegisterEventBus(GalagaBus.GetBus());
     stateMachine = new StateMachine(this);
     shotImages   = new Image(Path.Combine("Assets", "Images", "BulletRed2.png"));
     playerShots  = new List <PlayerShot>();
     GalagaBus.GetBus().Subscribe(GameEventType.InputEvent, this);
     GalagaBus.GetBus().Subscribe(GameEventType.WindowEvent, this);
 }
Exemplo n.º 3
0
        public Game()
        {
            gameTimer = new GameTimer();
            win       = new Window("Galaca", 500, AspectRatio.R1X1);

            // eventBus for various GameEvents
            eventBus = GalagaBus.GetBus();
            eventBus.InitializeEventBus(new List <GameEventType>()
            {
                GameEventType.GameStateEvent,
                GameEventType.InputEvent,
                GameEventType.WindowEvent,
                GameEventType.PlayerEvent
            });

            // The eventBus is linked to the window
            win.RegisterEventBus(eventBus);
            eventBus.Subscribe(GameEventType.WindowEvent, this);

            stateMachine = new StateMachine();
        }