Esempio n. 1
0
        public void InitializeGameState()
        {
            backGroundImage = new Entity(
                new StationaryShape(new Vec2F(0.0f, 0.0f), new Vec2F(1.0f, 1.0f)),
                new Image(Path.Combine("Assets", "Images", "SpaceBackground.png")));

            player = new Player();

            enemies      = new EntityContainer <Enemy>();
            enemyStrides = ImageStride.CreateStrides(4,
                                                     Path.Combine("Assets", "Images", "BlueMonster.png"));

            var sqr = new Squadron2();

            sqr.CreateEnemies(enemyStrides);
            enemies          = sqr.Enemies;
            movementStrategy = new ZigZagDown();

            playerShots = new EntityContainer();
            shotStride  = new Image(Path.Combine("Assets", "Images", "BulletRed2.png"));

            explosionStrides = ImageStride.CreateStrides(8,
                                                         Path.Combine("Assets", "Images", "Explosion.png"));
            explosions = new AnimationContainer(4);
        }
Esempio n. 2
0
        public Game()
        {
            gameTimer  = new GameTimer(60, 60);
            win        = new Window("Galaca", 500, AspectRatio.R1X1);
            backGround = new Image(Path.Combine("Assets", "Images", "SpaceBackground.png"));
            player     = new Player();

            enemies      = new EntityContainer <Enemy>();
            enemyStrides = ImageStride.CreateStrides(4,
                                                     Path.Combine("Assets", "Images", "BlueMonster.png"));

            var sqr = new Squadron2();

            sqr.CreateEnemies(enemyStrides);
            enemies          = sqr.Enemies;
            movementStrategy = new ZigZagDown();

            playerShots = new EntityContainer();
            shotStride  = new Image(Path.Combine("Assets", "Images", "BulletRed2.png"));

            explosionStrides = ImageStride.CreateStrides(8,
                                                         Path.Combine("Assets", "Images", "Explosion.png"));
            explosions = new AnimationContainer(4);

            eventBus = new GameEventBus <object>();
            eventBus.InitializeEventBus(new List <GameEventType>()
            {
                GameEventType.InputEvent,
                GameEventType.WindowEvent,
                GameEventType.PlayerEvent
            });

            win.RegisterEventBus(eventBus);
            eventBus.Subscribe(GameEventType.InputEvent, this);
            eventBus.Subscribe(GameEventType.WindowEvent, this);
        }