|
Post by ispanets on Jan 13, 2016 12:09:14 GMT
Hi! I am trying to use SetRoad(Vector3i position, bool exists) to load roads from a XML file, but it doesn't connect well the road sections created. What else must be done, besides calling SetRoad with the hex positions? Image hereThanks in advance, Jose
|
|
|
Post by khash on Jan 15, 2016 12:00:55 GMT
Hmm it does seem like it should be enough. Can you ensure that: SetTerrainOwnershipSingle is called somewhere on the line. It should find you "bestLayouts" which would connect roads.
Hope this helps
|
|
|
Post by ispanets on Jan 17, 2016 16:58:28 GMT
SetTerrainOwnershipSingle? No, there is nothing like that. This is what I call:
static public void SetRoad(Vector3i position, bool exists) { GetInstance().SetRoadAt(position, exists); }
public void SetRoadAt(Vector3i position, bool exists) { if (roadLocations.Contains(position) == exists) return;
if (exists == false) { roadLocations.Remove(position); } else { roadLocations.Add(position); }
UpdateArea(HexNeighbors.GetRange(position, 1)); }
public void UpdateArea(List<Vector3i> locations) { foreach(Vector3i pos in locations) { if (World.GetInstance().hexes.ContainsKey(pos)) { UpdateMarkerAt(pos, roadLocations.Contains(pos)); } } }
and so on....
Am I missing something?
|
|