Esempio n. 1
0
        public void InitializeBlendingRules(StrategyGameRules r)
        {
            var ts = this;

            ts.Add(new TerrainGraphic("coast", false, "t.blend.coast")
                   .WithMatchRule(0, TerrainMatchType.CellGroup, "t.l0.cellgroup", "shallow", "deep", "land")
                   .WithMatchRule(1, TerrainMatchType.Corner, "t.l1.coast_cell", "water", "ice"));

            ts.Add(new TerrainGraphic("floor", false, "t.blend.coast")
                   .WithMatchRule(0, TerrainMatchType.CellGroup, "t.l0.cellgroup", "deep", "shallow", "land")
                   .WithMatchRule(1, TerrainMatchType.Corner, "t.l1.floor_cell", "water", "ice"));

            ts.Add(new TerrainGraphic("arctic", false, "t.blend.arctic")
                   .WithMatchRule(0, TerrainMatchType.CellGroup, "t.l0.cellgroup", "shallow", "deep", "land")
                   .WithMatch(1, "ice")
                   .WithMatchRule(2, TerrainMatchType.Basic, "t.l0.arctic1", "ice"));

            ts.Add(new TerrainGraphic("desert", true)
                   .WithMatchRule(0, TerrainMatchType.CellGroup, "t.l0.cellgroup", "land", "deep", "shallow")
                   .WithMatch(1, "land")
                   .WithMatchRule(2, TerrainMatchType.Basic, "t.l0.desert1", "land"));

            ts.Add(new TerrainGraphic("forest", true)
                   .WithMatchRule(0, TerrainMatchType.CellGroup, "t.l0.cellgroup", "land", "deep", "shallow")
                   .WithMatch(1, "land")
                   .WithMatchRule(2, TerrainMatchType.Basic, "t.l0.forest1", "land")
                   .WithMatchRule(3, TerrainMatchType.Cardinal, "t.l1.forest", "forest", "forest"));

            ts.Add(new TerrainGraphic("grassland", true)
                   .WithMatchRule(0, TerrainMatchType.CellGroup, "t.l0.cellgroup", "land", "deep", "shallow")
                   .WithMatch(1, "land")
                   .WithMatchRule(2, TerrainMatchType.Basic, "t.l0.grassland1", "land"));

            ts.Add(new TerrainGraphic("hills", true)
                   .WithMatchRule(0, TerrainMatchType.CellGroup, "t.l0.cellgroup", "land", "deep", "shallow")
                   .WithMatch(1, "land")
                   .WithMatchRule(2, TerrainMatchType.Basic, "t.l0.hills1", "land")
                   .WithMatchRule(3, TerrainMatchType.Cardinal, "t.l1.hills", "hills", "hills"));

            ts.Add(new TerrainGraphic("mountains", true)
                   .WithMatchRule(0, TerrainMatchType.CellGroup, "t.l0.cellgroup", "land", "deep", "shallow")
                   .WithMatch(1, "land")
                   .WithMatchRule(2, TerrainMatchType.Basic, "t.l0.mountains1", "land")
                   .WithMatchRule(3, TerrainMatchType.Cardinal, "t.l1.mountains", "mountains", "mountains"));

            ts.Add(new TerrainGraphic("tundra", true)
                   .WithMatchRule(0, TerrainMatchType.CellGroup, "t.l0.cellgroup", "land", "deep", "shallow")
                   .WithMatch(1, "land")
                   .WithMatchRule(2, TerrainMatchType.Basic, "t.l0.tundra1", "land"));

            ts.Add(new TerrainGraphic("plains", true)
                   .WithMatchRule(0, TerrainMatchType.CellGroup, "t.l0.cellgroup", "land", "deep", "shallow")
                   .WithMatch(1, "land")
                   .WithMatchRule(2, TerrainMatchType.Basic, "t.l0.plains1", "land"));

            ts.Add(new TerrainGraphic("swamp", true)
                   .WithMatchRule(0, TerrainMatchType.CellGroup, "t.l0.cellgroup", "land", "deep", "shallow")
                   .WithMatch(1, "land")
                   .WithMatchRule(2, TerrainMatchType.Basic, "t.l0.swamp1", "land"));
        }
Esempio n. 2
0
        public StrategyGameData()
        {
            Rules         = new StrategyGameRules();
            TerrainHeight = 300;
            TerrainWidth  = 300;
            terrain       = new TerrainMap(TerrainWidth, TerrainHeight);
            Fog           = new WrappingFogMap(new FogMap(TerrainWidth, TerrainHeight), GridNavigation.CreateNavigator(RenderType.Grid).Wrap(TerrainWidth, TerrainHeight));

            Settlements = new SettlementManager();

            Players = new List <Player>
            {
                new Player("Barbarian", PlayerColor.Red, Culture.Celtic),
                new Player("Player A", PlayerColor.Green, Culture.Classical),
                new Player("Player B", PlayerColor.Blue, Culture.Celtic)
            };

            var r = new MapReader(Rules);

            r.Map = terrain;
            r.ReadTerrain(new StringReader(MapData.TerrainData), 0, 0, TerrainWidth, TerrainHeight);
            r.ReadRoads(new StringReader(MapData.RoadData), 0, 0, TerrainWidth, TerrainHeight);
            r.ReadRivers(new StringReader(MapData.RiverData), 0, 0, TerrainWidth, TerrainHeight);
            r.ReadImprovement(new StringReader(MapData.ImprovementData), 0, 0, TerrainWidth, TerrainHeight);
            r.ReadResources(new StringReader(MapData.ResourceData), 0, 0, TerrainWidth, TerrainHeight);

            AddSettlement(new Settlement("Capital City", new MapCoordinate(7, 13), 1, 4000, true));
            AddSettlement(new Settlement("Satellite Settlement", new MapCoordinate(20, 14), 2, 2000, false));

            // Explicitly set the initial visible tracker to the location of one of the cities
            // here so that the visibility marking works correctly.
            Fog.MarkRangeVisible(0, 0, 2);
            MousePosition = new MapCoordinate(7, 13);
        }
Esempio n. 3
0
 public MapReader(StrategyGameRules rules)
 {
     this.terrainsByCharId    = rules.TerrainTypes.ToIndexDict(t => t.AsciiId);
     this.resourcesByCharId   = rules.TerrainResourceTypes.ToIndexDict(r => r.AsciiId);
     this.roadsByCharId       = rules.RoadTypes.Where(r => !r.River).ToDict(r => r.AsciiId);
     this.improvementByCharId = rules.TerrainImprovementTypes.ToDict(r => r.AsciiId);
     this.river = rules.Roads.River;
 }