| | |
| | | public class EndlessLevelManager : Singleton<EndlessLevelManager> |
| | | { |
| | | /// <summary> |
| | | /// 起始关卡 |
| | | /// </summary> |
| | | /// <value></value> |
| | | protected int startLevel { get; set; } = 1; |
| | | |
| | | /// <summary> |
| | | /// 当前的关卡等级 |
| | | /// </summary> |
| | | public int CurrentLevel { get; set; } = 1; |
| | |
| | | private bool isStopSecondWaveCompleted = false; |
| | | |
| | | /// <summary> |
| | | /// 赛道长度 |
| | | /// </summary> |
| | | private float tunelLength = 31.94f; |
| | | |
| | | private List<Vector3> homeBasePositionList; |
| | | |
| | | /// <summary> |
| | | /// 根据赛道id(1~5)获得基地坐标 |
| | | /// </summary> |
| | | /// <param name="tunelId"></param> |
| | | /// <returns></returns> |
| | | public Vector3 GetHomeBasePosition(int tunelId) |
| | | { |
| | | return homeBasePositionList[tunelId - 1]; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据赛道id(1~5)和赛道类型获得世界坐标 |
| | | /// </summary> |
| | | /// <param name="tunelId"></param> |
| | | /// <param name="tunelType"></param> |
| | | public Vector3 GetTunelWorldPosition(int tunelId, EndlessBossSkillTunelType tunelType) |
| | | { |
| | | Vector3 startPos = StartingNodeList[tunelId - 1].transform.position; |
| | | Vector3 ret = new Vector3(startPos.x, startPos.y, startPos.z); |
| | | float add = 0; |
| | | |
| | | switch (tunelType) |
| | | { |
| | | case EndlessBossSkillTunelType.Top: |
| | | break; |
| | | case EndlessBossSkillTunelType.Center: |
| | | add = -(tunelLength / 2); |
| | | break; |
| | | case EndlessBossSkillTunelType.Bottom: |
| | | add = -tunelLength; |
| | | break; |
| | | } |
| | | |
| | | ret.z += add; |
| | | |
| | | return ret; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 切换基地 |
| | | /// </summary> |
| | | /// <param name="index">列索引</param> |
| | |
| | | { |
| | | EndlessBuffSelect.instance.BuffSelectCompleted += OnBuffSelectCompleted; |
| | | EndlessGameUI.instance.GameOverEvent += SafelyCallLevelCompleted; |
| | | |
| | | homeBasePositionList = new List<Vector3>(); |
| | | |
| | | for (int i = 0; i < StartingNodeList.Count; ++i) |
| | | { |
| | | Vector3 startPos = StartingNodeList[i].transform.position; |
| | | Vector3 pos = new Vector3(); |
| | | pos.x = startPos.x; |
| | | pos.y = startPos.y; |
| | | pos.z = startPos.z - tunelLength; |
| | | homeBasePositionList.Add(pos); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | CurrencyGainer.Tick(Time.deltaTime); |
| | | } |
| | | |
| | | // buff选择完成,开始波次 |
| | | if (!isBuffSelectCompleted) |
| | | { |
| | | isBuffSelectCompleted = true; |
| | | WaveManager.StartWaves(CurrentLevel); |
| | | if (CurrentLevel > startLevel) |
| | | WaveManager.InitPort(CurrentLevel); |
| | | EndlessUIStart.instance.Restart(); |
| | | WaveManager.StartWaves(CurrentLevel); |
| | | } |
| | | |
| | | // 本关卡所有波次全部生成完成 && 敌人全部被清理了,然后就去尝试进入下一关 |
| | | if (EndlessLeveltate == LevelState.SpawningEnemies && IsAllWaveCompleted && NumberOfEnemies == 0) |
| | | { |
| | | // 新手的话,第一关完了暂停 |
| | | if (!GameConfig.IsNewbie || GameConfig.IsNewbieGuideCompleted) |
| | | if (!GameConfig.IsNewbie) |
| | | { |
| | | if (!UpdateLevel()) |
| | | ChangeLevelState(LevelState.AllEnemiesSpawned); |
| | |
| | | protected virtual void AllWaveCompleted() |
| | | { |
| | | IsAllWaveCompleted = true; |
| | | EndlessBossSkillManager.instance.ClearSkillList(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public void NewbieUpdateLevel() |
| | | { |
| | | ++CurrentLevel; |
| | | WaveManager.InitPort(CurrentLevel); |
| | | IsAllWaveCompleted = false; |
| | | EndlessUIStart.instance.Restart(); |
| | | WaveManager.StartWaves(CurrentLevel); |
| | |
| | | { |
| | | if (EndlessGameUI.instance.state == EndlessGameUI.State.GameOver) return; |
| | | |
| | | if (CurrentLevel == startLevel) |
| | | WaveManager.InitPort(CurrentLevel); |
| | | |
| | | if (!GameConfig.IsNewbie) |
| | | ShowSelectBuffUI(); |
| | | else |