// Constructor if given a list of transforms public TerrainNodeList(List <Transform> transform_node_list, float _max_distance) { max_distance = _max_distance; foreach (Transform transform_node in transform_node_list) { terrain_node_list.Add(new TerrainNode(transform_node)); } TerrainNode.SortAdjacentNodes(terrain_node_list, max_distance); }
public void AddTerrainNode(Transform node) { TerrainNode terrain_node = new TerrainNode(node); terrain_node_list.Add(terrain_node); // TODO: Instead of reanalyzing the entire list, // there could be a method in TerrainNode (Heap-like structure) // that would update only the nodes that need to be updated. TerrainNode.SortAdjacentNodes(terrain_node_list, max_distance); }
public void RemoveTerrainNode(Transform transform_node) { foreach (TerrainNode terrain_node in terrain_node_list) { if (transform_node == terrain_node.transform) { terrain_node_list.Remove(terrain_node); // TODO: Instead of reanalyzing the entire list, // there could be a method in TerrainNode (Heap-like structure) // that would update only the nodes that need to be updated. TerrainNode.SortAdjacentNodes(terrain_node_list, max_distance); break; } } }