From a4c64bb18f6d754d3f1bc3785d83356cc0aef68c Mon Sep 17 00:00:00 2001 From: chenxin <chenxin6991@163.com> Date: Fri, 06 Nov 2020 17:45:59 +0800 Subject: [PATCH] Merge commit '67f6f473143047b0b0c9ba51791ff5747972f076' into master --- Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs index babb6dc..7f9fa31 100644 --- a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs +++ b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs @@ -246,6 +246,12 @@ /// </summary> public GameObject TowerAppearEffectPrefab; + /// <summary> + /// 保存所有生成或合成的塔的最小等级,索引0 -> 火木水塔 索引1 -> 技能塔 + /// </summary> + /// <value></value> + public int[] MinLevelArr = { 0, 0 }; + public IPlacementArea selfTowerPlaceArea { get @@ -260,6 +266,29 @@ } } + private void UpdateMinLevelArr() + { + int min1 = -1; + int min2 = -1; + + for (int i = 0; i < m_listTower.Count; ++i) + { + if (m_listTower[i].towerFeature == EFeatureTower.NULL) + { + if (min1 == -1 || m_listTower[i].currentLevel < min1) + min1 = m_listTower[i].currentLevel; + } + else + { + if (min2 == -1 || m_listTower[i].currentLevel < min2) + min2 = m_listTower[i].currentLevel; + } + } + + MinLevelArr[0] = Mathf.Max(min1, 0); + MinLevelArr[1] = Mathf.Max(min2, 0); + } + /// <summary> /// 增加一个防塔的数据结构,测试数据 /// </summary> @@ -267,6 +296,7 @@ public void addTower(Tower t) { m_listTower.Add(t); + UpdateMinLevelArr(); // 当前所在的位置是否攻击位置,随手瞎写:2 或者 3也就是前两排是上阵的 if (t.gridPosition.y >= 2) -- Gitblit v1.9.1