コード例 #1
0
        private void AddProvince(ICountry country, IList <IProvince> regions, IHexMap map, IProvince region, List <IProvince> redoCache)
        {
            if (region == null || (country.Provinces.Any() && !region.GetNeighbours(map).Intersect(country.Provinces).Any()))
            {
                foreach (var log in _trace)
                {
                    Debug.Log(log);
                }
                throw new InvalidOperationException($"{region} is not next to {country.Name}");
            }
            country.AddProvince(region);
            region.IsWater = false;

            _trace.Add($"Add Province: {region.Name}");
            Debug.Log($"Add Province: {region.Name}");

            foreach (var tile in region.HexTiles)
            {
                tile.TileTerrainType = TileTerrainType.Plain;
            }
            region.SetCapital(map);
            regions.Remove(region);
            redoCache.Add(region);
        }