public static FloorRouteLabel Singleton() { if (instance == null) { instance = FindObjectOfType <FloorRouteLabel>(); } return(instance); }
public static void SetLanguage(LANG new_language) { current_language = new_language; FloorRouteLabel.OnLanguageChanged(); for (int i = 0; i < all_instances.Count; i++) { all_instances[i].TranslateString(); } }
public void FindPath(Node startNode, Node endNode, out List <Vector3> path) { Node.ClearAllParents(); FindNodePath(startNode, endNode); path = RetracePath(endNode); if (path.Count > 1) { int floorStart = GetFloorFromNode(startNode); // Debug.Log(string.Format("<color=green>FloorStart: {0}-{1}</color>", startNode.nodeKey, floorStart)); int floorEnd = GetFloorFromNode(endNode); // Debug.Log(string.Format("<color=blue>FloorStart: {0}-{1}</color>", endNode.nodeKey, floorEnd)); FloorRouteLabel.SetFloorRouteText(floorStart, floorEnd); CameraController2.singleton.SetMiddlePoint(path[0], path[path.Count - 1]); } else { FloorRouteLabel.SetFloorRouteText(0, 0); } }
public void FindPathFromInputFields() { if (nodesDict == null) { Debug.LogError("nodeDict is null !!!"); return; } Node old_start_node = startNode; Node old_end_node = endNode; string nodeKey = from_InputField.text; nodeKey = GetOriginKey(nodeKey); nodeKey = nodeKey.Replace("WC ", string.Empty); if (nodesDict.ContainsKey(nodeKey)) { startNode = nodesDict[nodeKey]; } else { startNode = null; } nodeKey = destination_InputField.text; nodeKey = nodeKey.Replace("WC ", string.Empty); nodeKey = GetOriginKey(nodeKey); if (nodesDict.ContainsKey(nodeKey)) { endNode = nodesDict[nodeKey]; } else { endNode = null; } if (startNode != null && endNode != null) { FindPath(startNode, endNode, out path); vlr.points = path; vlr.RedrawLines(current_length); RectangleCreator.singleton.DrawRects(startNode.worldPos, endNode.worldPos); } else { FloorRouteLabel.SetFloorRouteText(0, 0); vlr.Hide(); RectangleCreator.singleton.Hide(); } SelectionManager2.singleton.CheckNode_visibility(old_start_node); SelectionManager2.singleton.CheckNode_visibility(old_end_node); SelectionManager2.singleton.CheckNode_visibility(startNode); SelectionManager2.singleton.CheckNode_visibility(endNode); SelectionManager2.singleton.SetFloor(SelectionManager2.singleton.currentFloor); }