public void Close() { if (currentOpenPanel == this) currentOpenPanel = null; Destroy(gameObject); }
public static void Open(MapNode node) { GameObject obj = (GameObject) Instantiate(Resources.Load("GUI/LocationInfoPanel")); obj.transform.SetParent(GameObject.Find("ScreenSpaceCanvas").transform, false); LocationInfoPanel panel = obj.GetComponent<LocationInfoPanel>(); panel.locationData = MapLocationDatabase.Instance.GetLocationData(node.locationID); panel.mapNode = node; if (currentOpenPanel != null) currentOpenPanel.Close(); currentOpenPanel = panel; }