| | |
| | | |
| | | 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> |
| | |
| | | /// <param name="level"></param> |
| | | public void InitPort(int level) |
| | | { |
| | | EndlessBuffData.InitEndlessBuffPool(level); |
| | | InitPortData(level); |
| | | InitWaveData(); |
| | | RefreshBoss(); |
| | |
| | | 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); |
| | |
| | | |
| | | if (faZhenRefreshTimer == null) |
| | | faZhenRefreshTimer = new Timer(time, UpdateWave); |
| | | } |
| | | |
| | | /// <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> |
| | |
| | | return waves[waveline].StartingNode.GetNextNode().transform.position; |
| | | } |
| | | |
| | | |
| | | private void RefreshBoss() |
| | | { |
| | | if (CurrentWaveIndex > 0 || TotalWaves == 1) |
| | |
| | | EndlessBossHPManager.instance.UpdateWave(TotalWaves - CurrentWaveIndex); |
| | | EndlessBossHPManager.instance.ShowHP(); |
| | | EndlessScoreManager.instance.ShowScore(); |
| | | EndlessLevelManager.instance.DropRate = EndlessPortData.GetDropRate(Level, CurrentWaveIndex); |
| | | reward tmpData = EndlessPortData.GetDropReward(Level, CurrentWaveIndex); |
| | | //if(tmpData!=null && tmpData.type == Protobuf.CURRENCY.Arenaexp)//暂时没法判断,需要新加字段 |
| | | if (tmpData != null) |
| | | EndlessLevelManager.instance.DropCoin = tmpData != null ? tmpData.count : 0; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | ++SpawnedTotalEnemies; |
| | | |
| | | if (GameConfig.IsNewbie && EndlessUIStart.instance.beginSkillStep && SpawnedTotalEnemies >= 8) |
| | | if (GameConfig.IsNewbie) |
| | | { |
| | | EndlessUIStart.instance.beginSkillStep = false; |
| | | EndlessLevelManager.instance.StopSecondWave(); |
| | | if (EndlessUIStart.instance.beginDragStep && SpawnedTotalEnemies >= 3) |
| | | { |
| | | EndlessUIStart.instance.beginDragStep = false; |
| | | EndlessLevelManager.instance.StopSecondWave(); |
| | | } |
| | | else if (EndlessUIStart.instance.guideThirdWaveStep) |
| | | { |
| | | //Debug.Log($"当前波次是木属性的 总怪物数量:{TotalEnemies} 当前已经生成了:{SpawnedTotalEnemies * 2}"); |
| | | if (TotalEnemies - (SpawnedTotalEnemies * 2) <= 0) |
| | | { |
| | | Debug.Log("延迟第三波生成完毕"); |
| | | StartCoroutine(BroadCastCreateThirdWaveDone()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | IEnumerator BroadCastCreateThirdWaveDone() |
| | | { |
| | | yield return new WaitForSeconds(0.5f); |
| | | EndlessUIStart.instance.guideThirdWaveStep = false; |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.CreateThirdWaveDone); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | foreach (EndlessPortConfig data in waveData) |
| | | { |
| | | if (waves[data.Config.tunel - 1].LineState == EndlessWaveLineState.Spawning) |
| | | waves[data.Config.tunel - 1].PauseWave(); |
| | | waves[data.Config.tunel - 1].PauseWave(); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | foreach (EndlessPortConfig data in waveData) |
| | | { |
| | | if (waves[data.Config.tunel - 1].LineState == EndlessWaveLineState.Spawning) |
| | | waves[data.Config.tunel - 1].RestartWave(); |
| | | waves[data.Config.tunel - 1].RestartWave(); |
| | | } |
| | | } |
| | | |