public void Start() { myWindow.parentCloseCallback = CloseWindow; if (PlayerGameManager.GetInstance != null) { if (PlayerGameManager.GetInstance.campaignData.mapPointList == null) { PlayerGameManager.GetInstance.campaignData.mapPointList = new List <MapPointInformationData>(); } MapPointInformationData checkIfTheresEmptyLand = PlayerGameManager.GetInstance.campaignData.mapPointList.Find(x => x.ownedBy == TerritoryOwners.Neutral); if (PlayerGameManager.GetInstance.campaignData.mapPointList.Count <= 0 || checkIfTheresEmptyLand != null && (checkIfTheresEmptyLand.troopsStationed == null || checkIfTheresEmptyLand.troopsStationed.Count <= 0)) { for (int i = 0; i < mapSelectionList.Count; i++) { currentMap = mapSelectionList[i]; if (currentMap.myMap.myMapPoints.Find(x => x.myPointInformation.ownedBy == TerritoryOwners.Neutral && (x.myPointInformation.troopsStationed == null || x.myPointInformation.troopsStationed.Count <= 0))) { GenerateMapUnits(); } } SaveMapUnits(); } else { InitializeMapUnits(); } } }
public void MapSelected(MapType type) { if (!selectedMapShowing) { currentMap = mapSelectionList.Find(x => x.mapType == type); currentMap.SwitchMapSelectedButton(false); StartCoroutine(selectionAnim.WaitAnimationForAction("Map Selected", UpdateMapShown)); if (ResourceInformationController.GetInstance != null) { ResourceInformationController.GetInstance.ShowResourcePanel(ResourcePanelType.bottom); } } else { int idx = mapSelectionList.FindIndex(x => x == currentMap); if (idx < mapSelectionList.Count - 1) { idx += 1; } else { idx = 0; } currentMap = mapSelectionList[idx]; UpdateMapShown(); } }
public void OnDisable() { selectedMapShowing = false; visualSelectedMap.gameObject.SetActive(false); currentMap = null; }