| | |
| | | /// <summary> |
| | | /// 当前波数据 |
| | | /// </summary> |
| | | protected List<EndlessPortConfig> waveData; |
| | | public List<EndlessPortConfig> WaveData { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 实际上就是5条兵线 |
| | |
| | | HideTunel(); |
| | | EventCenter.Ins.Add<float>((int)KTGMGemClient.EventType.EndlessAgentTaskDamage, OnHit); |
| | | EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.WaveLineFinish, WaveLineFinish); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | InitWaveData(); |
| | | RefreshBoss(); |
| | | |
| | | endless_boss boss = EndlessBossData.GetDataById(WaveData[0].Config.resource); |
| | | |
| | | if (boss != null) |
| | | EndlessBossCtrl.instance.RefreshBody(boss.image); |
| | | |
| | | if (!GameConfig.IsNewbie) |
| | | { |
| | | endless_boss bossData = EndlessBossData.GetDataById(waveData[0].Config.resource); |
| | | endless_boss bossData = EndlessBossData.GetDataById(WaveData[0].Config.resource); |
| | | |
| | | if (bossData != null) |
| | | EndlessBossSkillManager.instance.Init(bossData.skill); |
| | |
| | | float time = 0; |
| | | |
| | | // 刷新法阵的显示 |
| | | for (int i = 0; i < waveData.Count; ++i) |
| | | for (int i = 0; i < WaveData.Count; ++i) |
| | | { |
| | | 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); |
| | | int tunel = WaveData[i].Config.tunel; |
| | | int tunelBgId = WaveData[i].Config.tunel_bg; |
| | | TunelList[tunel - 1].material = Resources.Load<Material>($"{tunelMaterialPath}{tunelBgId}"); |
| | | GameObject obj = Resources.Load<GameObject>($"{faZhenPath}{tunelBgId}{tunelBgId}"); |
| | | GameObject faZhen = Instantiate(obj); |
| | |
| | | return waves[waveline].StartingNode.GetNextNode().transform.position; |
| | | } |
| | | |
| | | |
| | | private void RefreshBoss() |
| | | { |
| | | if (CurrentWaveIndex > 0 || TotalWaves == 1) |
| | | EndlessBossHPManager.instance.SwitchHP(CurrentWaveIndex == TotalWaves - 1); |
| | | EndlessBossHPManager.instance.InitHP(EndlessPortData.GetWaveEnemiesTotalHP(Level, CurrentWaveIndex)); |
| | | EndlessBossHPManager.instance.SetBossInfo($"第{Level}关 {waveData[0].Config.boss_name}"); |
| | | |
| | | if (GameConfig.IsNewbie) |
| | | EndlessBossHPManager.instance.SetBossInfo($"新手关 {WaveData[0].Config.boss_name}"); |
| | | else |
| | | { |
| | | int level = GameConfig.IsNewbieStart ? Level - EndlessPortData.NewbieTotalLevel : Level; |
| | | EndlessBossHPManager.instance.SetBossInfo($"第{level}关 {WaveData[0].Config.boss_name}"); |
| | | } |
| | | |
| | | EndlessBossHPManager.instance.UpdateWave(TotalWaves - CurrentWaveIndex); |
| | | EndlessBossHPManager.instance.ShowHP(); |
| | | EndlessScoreManager.instance.ShowScore(); |
| | | EndlessLevelManager.instance.DropRate = EndlessPortData.GetDropRate(Level, CurrentWaveIndex); |
| | | //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> |
| | |
| | | /// </summary> |
| | | private void InitWaveData() |
| | | { |
| | | waveData = LevelData[CurrentWaveIndex]; |
| | | WaveData = LevelData[CurrentWaveIndex]; |
| | | // 直接取第一条就行了 |
| | | WaveInterval = waveData[0].Config.cooldown / 1000f; |
| | | TotalWaveLines = waveData.Count; |
| | | WaveInterval = WaveData[0].Config.cooldown / 1000f; |
| | | TotalWaveLines = WaveData.Count; |
| | | CompletedWaveLine = 0; |
| | | SpawnedTotalEnemies = 0; |
| | | } |
| | |
| | | TotalEnemies = EndlessPortData.GetWaveEnemiesCount(Level, CurrentWaveIndex); |
| | | RemainEnemies = TotalEnemies; |
| | | |
| | | foreach (EndlessPortConfig data in waveData) |
| | | foreach (EndlessPortConfig data in WaveData) |
| | | { |
| | | // 兵线被摧毁了,就不再出兵了,实际上只要不是Wait状态 都应该不能出兵 |
| | | if (waves[data.Config.tunel - 1].LineState == EndlessWaveLineState.Destroyed) |
| | |
| | | |
| | | if (GameConfig.IsNewbie) |
| | | { |
| | | if (EndlessUIStart.instance.beginDragStep && SpawnedTotalEnemies >= 3) |
| | | if (EndlessUIStart.instance.beginDragStep && SpawnedTotalEnemies >= 5) |
| | | { |
| | | //Debug.Log("这里本来要做一大波敌人的,现在注释掉"); |
| | | |
| | | EndlessUIStart.instance.beginDragStep = false; |
| | | EndlessLevelManager.instance.StopSecondWave(); |
| | | } |
| | | else if (EndlessUIStart.instance.guideThirdWaveStep) |
| | | else if (EndlessUIStart.instance.guideFourthWaveStep) |
| | | { |
| | | //Debug.Log($"当前波次是木属性的 总怪物数量:{TotalEnemies} 当前已经生成了:{SpawnedTotalEnemies * 2}"); |
| | | if (TotalEnemies - (SpawnedTotalEnemies * 2) <= 0) |
| | |
| | | IEnumerator BroadCastCreateThirdWaveDone() |
| | | { |
| | | yield return new WaitForSeconds(0.5f); |
| | | EndlessUIStart.instance.guideThirdWaveStep = false; |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.CreateThirdWaveDone); |
| | | EndlessUIStart.instance.guideFourthWaveStep = false; |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.CreateFourthWaveDone); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public void PauseAllWave() |
| | | { |
| | | foreach (EndlessPortConfig data in waveData) |
| | | foreach (EndlessPortConfig data in WaveData) |
| | | { |
| | | if (waves[data.Config.tunel - 1].LineState == EndlessWaveLineState.Spawning) |
| | | waves[data.Config.tunel - 1].PauseWave(); |
| | |
| | | /// </summary> |
| | | public void RestartAllWave() |
| | | { |
| | | foreach (EndlessPortConfig data in waveData) |
| | | foreach (EndlessPortConfig data in WaveData) |
| | | { |
| | | if (waves[data.Config.tunel - 1].LineState == EndlessWaveLineState.Spawning) |
| | | waves[data.Config.tunel - 1].RestartWave(); |
| | |
| | | ++CurrentWaveIndex; |
| | | EndlessBuffManager.instance.UpdateBuffList(); |
| | | EndlessBossSkillManager.instance.Reset(); |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessCompletedPort, Level, CurrentWaveIndex); |
| | | //EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessCompletedPort, Level, CurrentWaveIndex); |
| | | |
| | | if (CurrentWaveIndex >= TotalWaves) |
| | | // 当前关卡的所有波次全部完成 |