using System; using System.Collections; using System.Collections.Generic; using TMPro; using TowerDefense.Level; using TowerDefense.Towers; using UnityEngine; using UnityEngine.UI; public struct TowerLevelUp { public string towerName; public int newLvl; } public class SceneTowerLvl : MonoBehaviour { /// /// 当前的等级. /// public int currentLvl = 1; /// /// 升级需要的现金. /// public int upgradeCash = 100; public TextMeshProUGUI lvTextNew; public TextMeshProUGUI cashTextNew; public Image cashIcon; /// /// 是否可交互. /// public bool canInteract = true; /// /// 游戏场景内的TowerLvl升级 /// public event Action actionSceneTowerLvlUp; /// /// 当前数据对应的场景内Tower. /// protected Tower towerData; /// /// 己方唯一的数据,定位战斗中防塔的局内等级。 /// protected static Dictionary inSceneTowerLvl = new Dictionary(); /// /// 初始化当前数据的TowerData. /// /// public void SetTowerData( Tower td) { this.towerData = td; // 初始化局内等级数据为零. td.inSceneTowerLevel = 0; this.GetComponent().sprite = td.uiImage; } public void enableSceneTower( bool enable ) { Button btn = this.GetComponent