Esempio n. 1
0
 public ColorWarsGame(ColorWarsSettings settings)
 {
     this.settings              = settings;
     this.playerList            = new List <PlayerModel>();
     this.playerControllersList = new List <PlayerController>();
     this.gameBoard             = new GameBoard(this.settings.StartingTerritorySize, this.settings.MapDimension);
     this.gameRenderer          = new GameRenderer(new GraphicsDeviceManager(this), this.settings);
     this.gameActors            = new ActorList();
     this.scoreboard            = new Scoreboard(this.playerList, this.gameBoard);
 }
Esempio n. 2
0
        private static void Main()
        {
            ColorWarsSettings settings;

            try
            {
                settings = Newtonsoft.Json.JsonConvert.DeserializeObject <ColorWarsSettings>(File.ReadAllText("settings.json"));
            }
            catch (FileNotFoundException)
            {
                settings = new ColorWarsSettings();

                string json = Newtonsoft.Json.JsonConvert.SerializeObject(settings, Newtonsoft.Json.Formatting.Indented);
                File.WriteAllText("settings.json", json);
            }

            using (var game = new ColorWarsGame(settings))
                game.Run();
        }