public static void ClearSelectedTower() { if (instance.selectedTower == null) { return; } instance.selectedTower = null; UITowerInfo.Hide(); GameControl.ClearSelectedTower(); }
void SelectTower(UnitTower tower) { selectedTower = tower; Vector3 screenPos = Camera.main.WorldToScreenPoint(selectedTower.thisT.position); UITowerInfo.SetScreenPos(screenPos); UITowerInfo.Show(selectedTower, true); }
public void OnExitHoverButton(GameObject butObj) { if (GameControl.GetSelectedTower() != null && !GameControl.GetSelectedTower().IsSampleTower()) { return; } BuildManager.ClearSampleTower(); //clear tooltip UITowerInfo.Hide(); }
void Start() { instance = this; thisObj = gameObject; //for build cost List <Rsc> rscList = ResourceManager.GetResourceList(); for (int i = 0; i < rscList.Count; i++) { if (i == 0) { rscObjList[i].Init(); } else { rscObjList.Add(rscObjList[0].Clone("RscObj" + i, new Vector3(i * 80, 0, 0))); } rscObjList[i].imageIcon.sprite = rscList[i].icon; } rscObj = rscObjList[0].rootT.parent.gameObject; //for upgrade/selling cost for (int i = 0; i < rscList.Count; i++) { if (i == 0) { rscTooltipObjList[i].Init(); } else { rscTooltipObjList.Add(rscTooltipObjList[0].Clone("RscObj" + i, new Vector3(i * 50, 0, 0))); } rscTooltipObjList[i].imageIcon.sprite = rscList[i].icon; } float offset = 0.5f * (rscList.Count - 1) * 50; for (int i = 0; i < rscList.Count; i++) { rscTooltipObjList[i].rootT.localPosition += new Vector3(-offset, 0, 0); } rscTooltipObj.GetComponent <RectTransform>().sizeDelta += new Vector2((rscList.Count - 1) * 50, 0); rscTooltipObj.SetActive(false); Hide(); }
public void OnHoverTowerButton(GameObject butObj) { if (GameControl.GetSelectedTower() != null) { return; } int ID = GetButtonID(butObj); UnitTower tower = BuildManager.GetSampleTower(ID); if (!UI.UseDragNDrop()) { BuildManager.ShowSampleTower(ID); } //clear sample //show tooltip UITowerInfo.Show(tower); }