| | |
| | | } |
| | | |
| | | float lastTime; |
| | | float lastSendTime; |
| | | public override void Run() |
| | | { |
| | | //最低1秒 |
| | | if (Time.time - lastTime < 0.2f) |
| | | if (Time.time - lastTime < 0.3f) |
| | | return; |
| | | lastTime = Time.time; |
| | | |
| | | if (AutoFightModel.Instance.isPause) |
| | | return; |
| | | |
| | | |
| | | // 自动挑战boss |
| | | if (AutoFightModel.Instance.isAutoChallengeBoss) |
| | | if (AutoChallengeBoss()) |
| | | { |
| | | if (!MainLevelManager.Instance.CanChallengeBoss()) |
| | | { |
| | | DoNext(); |
| | | return; |
| | | } |
| | | //上次挑战boss失败了,再次尝试要等CD |
| | | if (AutoFightModel.Instance.nowChallengeCount > 0 && |
| | | Time.time - AutoFightModel.Instance.lastChallengeTime < AutoFightModel.Instance.maxTryChallengeCD) |
| | | { |
| | | DoNext(); |
| | | return; |
| | | } |
| | | //已经开始boss战斗 |
| | | BattleField battleField = BattleManager.Instance.GetActiveBattleFieldByName(BattleConst.StoryBossBattleField); |
| | | if (battleField != null) |
| | | return; |
| | | if (Time.time - lastSendTime < 1.0f) |
| | | return; |
| | | lastSendTime = Time.time; |
| | | Debug.Log($"开始挑战boss ServerNow{TimeUtility.ServerNow}"); |
| | | FightBoss(); |
| | | return; |
| | | } |
| | | DoNext(); |
| | |
| | | BattleManager.Instance.storyBattleField.CleanBattle(); |
| | | AutoFightModel.Instance.isPause = true; |
| | | } |
| | | |
| | | bool AutoChallengeBoss() |
| | | { |
| | | // 自动挑战boss |
| | | if (AutoFightModel.Instance.isAutoChallengeBoss) |
| | | { |
| | | if (AutoFightModel.Instance.nowChallengeCount == -1) |
| | | { |
| | | return false; |
| | | } |
| | | if (!MainLevelManager.Instance.CanChallengeBoss()) |
| | | { |
| | | return false; |
| | | } |
| | | //上次挑战boss失败了,再次尝试要等CD |
| | | if (Time.time - AutoFightModel.Instance.lastChallengeTime < AutoFightModel.Instance.maxTryChallengeCD) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (!UIManager.Instance.IsOpened<HomeWin>()) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (NewBieCenter.Instance.inGuiding) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (UIManager.Instance.ExistAnyFullScreenOrMaskWin("")) |
| | | { |
| | | return false; |
| | | } |
| | | FightBoss(); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |