public void Init(Map map, GraphNode n) { Map = map; Position = n.Vertex; transform.position = new Vector3(n.Vertex.x, 0, n.Vertex.y); transform.localScale = new Vector3(Scale, Scale, Scale); Type = n.Type; DistanceFromNearestOcean = n.DistanceFromNearestOcean; ConnectedBorderPoints = n.ConnectedNodes.Select(x => x.BorderPoint).ToList(); Borders = n.Connections.Select(x => x.Border).ToList(); Regions = n.Polygons.Select(x => x.Region).ToList(); RiverWidth = n.RiverWidth; }
public void SetType() { if (Type == BorderPointType.Edge) { return; } else if (Polygons.All(x => x.IsWater)) { Type = BorderPointType.Water; } else if (Polygons.Any(x => x.IsWater)) { Type = BorderPointType.Shore; } else { Type = BorderPointType.Inland; } }
public BorderPoint BorderPoint; // corresponding visual border point on the map public GraphNode(Vector2 v, PolygonMapGenerator PMG) { Id = idCounter++; Vertex = v; Type = (v.x == 0 || v.x == PMG.GenerationSettings.Width || v.y == 0 || v.y == PMG.GenerationSettings.Height) ? BorderPointType.Edge : BorderPointType.Inland; }