void GenerateCityConnections() { for (int i = 0; i < this.cities.Count; i++) { CityTileTest currentCityTile = this.cities[i].GetComponent <CityTileTest>(); int nextCityIndex = i + 1; int previousCityIndex = i - 1; if (nextCityIndex >= this.cities.Count) { nextCityIndex = 0; } if (previousCityIndex < 0) { previousCityIndex = 5; } currentCityTile.cityAttributes.AddCityAsConnected(this.cities [nextCityIndex].GetComponent <CityTileTest>()); currentCityTile.cityAttributes.AddCityAsConnected(this.cities [previousCityIndex].GetComponent <CityTileTest>()); Tile thisCity = currentCityTile.GetComponent <HexTile>().tile; for (int j = 0; j < currentCityTile.cityAttributes.connectedCities.Count; j++) { Tile tileToConnectTo = currentCityTile.cityAttributes.connectedCities[j].hexTile.tile; thisCity.canPass = true; tileToConnectTo.canPass = true; List <Tile> roads = GetPath(thisCity, tileToConnectTo, PATHFINDING_MODE.ROAD_CREATION).ToList(); for (int k = 0; k < roads.Count; k++) { roads [k].hexTile.isRoad = true; if (!roads [k].hexTile.isCity && !roads [k].hexTile.isOccupied) { roads [k].hexTile.SetTileColor(Color.gray); } } thisCity.canPass = false; tileToConnectTo.canPass = false; } } }
//----------------------------------------------------------------------------------------------- internal void AddCityToKingdom(CityTileTest city) { this.cities.Add(city); city.cityAttributes.kingdomTile = this.kingdomTile; city.GetComponent <HexTile> ().SetTileColor(this.tileColor); }