/// <summary> /// Belongs to InitalizeEventTrigger(). /// /// Author: Steven Johnson, David Askari /// </summary> /// <param name="data">Information about the event.</param> public void OnPointerEnterDelegate(PointerEventData data) { if (!PauseGame.Status) { TowerInformation.ShowHoveringTower(TowerPrefab.GetComponent <Tower>()); } }
/// <summary> /// Setup mouse trigger, the price text and the button. /// This get's called after Initalize()! /// /// Author: David Askari /// </summary> private void Start() { InitalizeEventTrigger(); TextMeshProUGUI priceText = this.transform.Find("PricePanel").GetComponentInChildren <TextMeshProUGUI>(); priceText.text = TowerPrefab.GetComponent <Tower>().BaseCosts.ToString() + " <sprite=1>"; priceText.SetText("{0} <sprite=1>", TowerPrefab.GetComponent <Tower>().BaseCosts); towerButton = GetComponent <Button>(); towerButton.onClick.AddListener(OnClickListener); }
/// <summary> /// Check whether this TowerBtn button should be interactable based on player's money. /// /// Author: David Askari /// </summary> public void CheckEnoughMoney() { towerButton.interactable = TowerPrefab.GetComponent <Tower>().BaseCosts <= GameManager.money ? true : false; }