public static void GameOver(int imageNumber)
        {
            IsGameOver = true;

            drawGraphics           = null;
            window.BackgroundImage = Model.Backgrounds[imageNumber];
            AudioController.StopBackgroundSound();
        }
Beispiel #2
0
        public static void InitializeController()
        {
            window = Program.MainWindow;

            // Subscribe to the notify event
            window.ViewNotification += Window_ViewNotification;
            player = Player.PlayerInstance;
            player.Initialize();
            // Lazy initialization of projectile pool
            projectilePool = ProjectilePool.Instance;
            projectilePool.Initialize();

            /*for (int i = 0; i < MapLoader.MonstersCount; i++)
             * {
             *  IndexPair startPoint = new IndexPair(MapLoader.Monsters[i].StartPoint.X, MapLoader.Monsters[i].StartPoint.Y);
             *  IndexPair endPoint = new IndexPair(MapLoader.Monsters[i].EndPoint.X, MapLoader.Monsters[i].EndPoint.Y);
             *  Monster mon = new Monster(startPoint, endPoint);
             *  movingObjects.Add(mon);
             * }*/

            for (int i = 0; i < MapLoader.BombsCount; i++)
            {
                IndexPair start = new IndexPair(MapLoader.Bombs[i].StartPoint.X, MapLoader.Bombs[i].StartPoint.Y);
                BombA     bomb  = new BombA(start);
                constantObjects.Add(bomb);
            }

            for (int i = 0; i < MapLoader.CoinsCount; i++)
            {
                IndexPair start = new IndexPair(MapLoader.Coins[i].StartPoint.X, MapLoader.Coins[i].StartPoint.Y);
                CoinGift  coin  = new CoinGift(start);
                constantObjects.Add(coin);
            }

            for (int i = 0; i < MapLoader.BulletsCount; i++)
            {
                IndexPair  start  = new IndexPair(MapLoader.Bullets[i].StartPoint.X, MapLoader.Bullets[i].StartPoint.Y);
                BulletGift bullet = new BulletGift(start);
                constantObjects.Add(bullet);
            }

            movingObjects.Add(player);
            backgroundIllusionTimer.Interval = 100;
            backgroundIllusionTimer.Elapsed += BackgroundIllusionTimer_Elapsed;
            backgroundIllusionTimer.Enabled  = true;

#if !DEBUG
#endif
            drawGraphics += DrawMovingBackground;
            drawGraphics += MapLoader.DrawGameFlares;
            drawGraphics += MapLoader.DrawLevelFloor;
            drawGraphics += MapLoader.DrawLevelObstacles;
            drawGraphics += player.UpdateGraphics;
            drawGraphics += UpdateTiles;
            drawGraphics += DrawShots;
        }
        public static void InitializeController()
        {
            window = Program.MainWindow;

            // Subscribe to the notify event
            window.ViewNotification += Window_ViewNotification;
            player = Player.PlayerInstance;
            player.Initialize();
            // Lazy initialization of projectile pool
            projectilePool = ProjectilePool.Instance;
            projectilePool.Initialize();

            /*for (int i = 0; i < MapLoader.MonstersCount; i++)
            {
                IndexPair startPoint = new IndexPair(MapLoader.Monsters[i].StartPoint.X, MapLoader.Monsters[i].StartPoint.Y);
                IndexPair endPoint = new IndexPair(MapLoader.Monsters[i].EndPoint.X, MapLoader.Monsters[i].EndPoint.Y);
                Monster mon = new Monster(startPoint, endPoint);
                movingObjects.Add(mon);
            }*/

            for (int i = 0; i < MapLoader.BombsCount; i++)
            {
                IndexPair start = new IndexPair(MapLoader.Bombs[i].StartPoint.X, MapLoader.Bombs[i].StartPoint.Y);
                BombA bomb = new BombA(start);
                constantObjects.Add(bomb);
            }

            for (int i = 0; i < MapLoader.CoinsCount; i++)
            {
                IndexPair start = new IndexPair(MapLoader.Coins[i].StartPoint.X, MapLoader.Coins[i].StartPoint.Y);
                CoinGift coin = new CoinGift(start);
                constantObjects.Add(coin);
            }

            for (int i = 0; i < MapLoader.BulletsCount; i++)
            {
                IndexPair start = new IndexPair(MapLoader.Bullets[i].StartPoint.X, MapLoader.Bullets[i].StartPoint.Y);
                BulletGift bullet = new BulletGift(start);
                constantObjects.Add(bullet);
            }

            movingObjects.Add(player);
            backgroundIllusionTimer.Interval = 100;
            backgroundIllusionTimer.Elapsed += BackgroundIllusionTimer_Elapsed;
            backgroundIllusionTimer.Enabled = true;

#if !DEBUG

#endif
            drawGraphics += DrawMovingBackground;
            drawGraphics += MapLoader.DrawGameFlares;
            drawGraphics += MapLoader.DrawLevelFloor;
            drawGraphics += MapLoader.DrawLevelObstacles;
            drawGraphics += player.UpdateGraphics;
            drawGraphics += UpdateTiles;
            drawGraphics += DrawShots;
        }