chenxin
2020-11-20 340c905aeb2d12c091eb6a62fa1502d05a0d7c9f
一次性buff重复出现问题
3 files modified
24 ■■■■■ changed files
Assets/Scripts/Data/EndlessBuffData.cs 19 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Level/EndlessLevelManager.cs 4 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Level/EndlessWaveManager.cs 1 ●●●● patch | view | raw | blame | history
Assets/Scripts/Data/EndlessBuffData.cs
@@ -74,6 +74,11 @@
        private static List<EndlessBuffConfig> randomBuffList;
        /// <summary>
        /// 一次性出现的buff id列表
        /// </summary>
        private static List<int> removedIdList;
        /// <summary>
        /// 颜色品阶
        /// </summary>
        /// <typeparam name="Color"></typeparam>
@@ -90,6 +95,7 @@
            endlessBuffList = JsonDataCenter.GetList<endless_buff>();
            allEndlessConfig = new List<EndlessBuffConfig>();
            randomBuffList = new List<EndlessBuffConfig>();
            removedIdList = new List<int>();
            random = new System.Random();
            foreach (endless_buff data in endlessBuffList)
@@ -131,6 +137,9 @@
            for (int i = 0; i < allEndlessConfig.Count; ++i)
            {
                // 如果是一次性的buff就不再出现了
                if (removedIdList.Contains(allEndlessConfig[i].Config.id)) continue;
                if (level >= allEndlessConfig[i].Config.down_level && level <= allEndlessConfig[i].Config.upper_level)
                    endlessBuffPool.Add(allEndlessConfig[i]);
            }
@@ -142,14 +151,7 @@
        /// <param name="id"></param>
        public static void RemoveFromBuffPool(int id)
        {
            for (int i = 0; i < endlessBuffPool.Count; ++i)
            {
                if (endlessBuffPool[i].Config.id == id)
                {
                    endlessBuffPool.Remove(endlessBuffPool[i]);
                    break;
                }
            }
            removedIdList.Add(id);
        }
        /// <summary>
@@ -181,7 +183,6 @@
            }
            randomBuffList = ret;
            return ret;
        }
Assets/Scripts/TowerDefense/Level/EndlessLevelManager.cs
@@ -441,6 +441,7 @@
        public void NewbieUpdateLevel()
        {
            ++CurrentLevel;
            EndlessBuffData.InitEndlessBuffPool(CurrentLevel);
            WaveManager.InitPort(CurrentLevel);
            IsAllWaveCompleted = false;
            EndlessUIStart.instance.Restart();
@@ -464,7 +465,10 @@
        {
            if (EndlessGameUI.instance.state == EndlessGameUI.State.GameOver) return;
            EndlessBuffData.InitEndlessBuffPool(CurrentLevel);
            if (CurrentLevel == startLevel)
                WaveManager.InitPort(CurrentLevel);
            if (!GameConfig.IsNewbie)
Assets/Scripts/TowerDefense/Level/EndlessWaveManager.cs
@@ -165,7 +165,6 @@
        /// <param name="level"></param>
        public void InitPort(int level)
        {
            EndlessBuffData.InitEndlessBuffPool(level);
            InitPortData(level);
            InitWaveData();
            RefreshBoss();