/// <summary> /// Generates the biomes each area has /// </summary> void GenerateBiomes() { AreaGraph = new AreaGraph(Areas.Values.ToList(), this); AreaGraph.ColorGraph(); MergeAreasWithSameBiome(AreaGraph); foreach (AreaNode node in AreaGraph.GetNodes()) { if (Areas.ContainsKey(node.NodeID)) { Area areaForNode = Areas[node.NodeID]; areaForNode.GenerateBiomeForArea(node.GetColor()); } } }
/// <summary> /// TEMP /// </summary> /// <param name="g"></param> void DrawGraph(AreaGraph g) { foreach (AreaNode node in g.GetNodes()) { Gizmos.color = biomeTypeToMaterialDictionary[node.GetColor()].color; HexCell centerCell = map.GetAreaByID(node.NodeID).Cells[0]; Vector3 nodePos = Converter.V2ToV3(Map.HexCellToWorldPosition(centerCell)); Gizmos.DrawSphere(nodePos, 1); Gizmos.color = Color.cyan; foreach (uint node2 in node.Edges) { HexCell edgeNode = map.GetAreaByID(node2).Cells[0]; Vector3 nodePos2 = Converter.V2ToV3(Map.HexCellToWorldPosition(edgeNode)); Gizmos.DrawLine(nodePos, nodePos2); } }// end i }