From 9ed56dda66d5e8f6968730a46f908dfe1357c15e Mon Sep 17 00:00:00 2001 From: wangguan <wangguan@kt007.com> Date: Mon, 16 Nov 2020 15:26:23 +0800 Subject: [PATCH] 修改法阵特效 修改loading适配 --- Assets/Scripts/TowerDefense/Level/EndlessWaveManager.cs | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 57 insertions(+), 1 deletions(-) diff --git a/Assets/Scripts/TowerDefense/Level/EndlessWaveManager.cs b/Assets/Scripts/TowerDefense/Level/EndlessWaveManager.cs index d53e250..c07baf8 100644 --- a/Assets/Scripts/TowerDefense/Level/EndlessWaveManager.cs +++ b/Assets/Scripts/TowerDefense/Level/EndlessWaveManager.cs @@ -102,10 +102,19 @@ private Timer faZhenRefreshTimer; + + /// <summary> + /// 管理法阵的对象池 + /// </summary> + /// <returns></returns> + private Dictionary<string, List<GameObject>> faZhenDic = new Dictionary<string, List<GameObject>>(); private void Start() { + faZhenDic = new Dictionary<string, List<GameObject>>(); HideTunel(); EventCenter.Ins.Add<float>((int)KTGMGemClient.EventType.EndlessAgentTaskDamage, OnHit); + EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.WaveLineFinish, WaveLineFinish); + } /// <summary> @@ -220,8 +229,38 @@ int tunel = waveData[i].Config.tunel; int tunelBgId = waveData[i].Config.tunel_bg; + // string key = $"{faZhenPath}{tunelBgId}{tunelBgId}"; + // List<GameObject> allPS; + // GameObject tmpPSObj = null; + // if (faZhenDic.ContainsKey(key)) + // { + // allPS = faZhenDic[key]; + // foreach (GameObject item in allPS) + // { + // if (item.activeSelf) + // { + // tmpPSObj = item; + // break; + // } + // } + // } + + // if (tmpPSObj == null) + // { + // allPS = new List<GameObject>(); + // GameObject obj = Resources.Load<GameObject>($"{faZhenPath}{tunelBgId}{tunelBgId}"); + // GameObject faZhen = Instantiate(obj); + // tmpPSObj = faZhen; + // allPS.Add(faZhen); + // faZhenDic.Add(key, allPS); + // } + + // tmpPSObj.transform.SetParent(TunelList[tunel - 1].gameObject.transform); + // tmpPSObj.transform.localPosition = new Vector3(0, 1, 0); + // tmpPSObj.transform.localScale = new Vector3(2, 2, 2); + // TunelList[tunel - 1].gameObject.SetActive(true); TunelList[tunel - 1].material = Resources.Load<Material>($"{tunelMaterialPath}{tunelBgId}"); - GameObject obj = Resources.Load<GameObject>($"{faZhenPath}{tunelBgId}"); + GameObject obj = Resources.Load<GameObject>($"{faZhenPath}{tunelBgId}{tunelBgId}"); GameObject faZhen = Instantiate(obj); faZhen.transform.SetParent(TunelList[tunel - 1].gameObject.transform); @@ -240,6 +279,23 @@ } /// <summary> + /// 延迟关闭法阵 + /// </summary> + /// <param name="WaveLineId"></param> + private void WaveLineFinish(int WaveLineId) + { + //StartCoroutine(CloseFaZhen(WaveLineId)); + } + + IEnumerator CloseFaZhen(int WaveLineId) + { + yield return new WaitForSeconds(1.0f); + Debug.Log("当前列出怪完成,WaveLineId:" + WaveLineId); + + TunelList[WaveLineId - 1].gameObject.SetActive(false); + } + + /// <summary> /// 敌人数量减少 /// </summary> /// <param name="count"></param> -- Gitblit v1.9.1