Пример #1
0
 public GameLogic(World gameWorld, GameSettings gameSettings, GameControlState gameControlState)
 {
     this.gameWorld                           = gameWorld;
     this.gameSettings                        = gameSettings;
     this.gameControlState                    = gameControlState;
     this.random                              = new Random();
     this.framesSinceLastFire                 = new Dictionary <int, int>();
     this.framesSinceLastDeath                = new Dictionary <int, int>();
     this.tankCollectedPowerupsCount          = new Dictionary <int, int>();
     this.framesSinceLastPowerupSpawned       = 0;
     this.framesSinceLastPowerupSpawnedToWait = random.Next(1, gameSettings.MaxPowerupDelay);
 }
Пример #2
0
        public GameController()
        {
            // Initialize GameSettings
            GameSettings = new GameSettings();
            string settingsFilePath = @"..\..\..\..\Resources\Server\settings.xml";

            GameSettings.ReadSettingsFile(settingsFilePath);

            // Setup a new world
            GameWorld      = new World();
            GameWorld.Size = GameSettings.UniverseSize;

            GameDurationInSeconds = 0;
            gameDurationInFrames  = 0;

            // Create a GameControlState to hold game control state of the world
            gameControlState = new GameControlState();

            gameLogic = new GameLogic(GameWorld, GameSettings, gameControlState);
        }