lcy
2025-10-27 a4b795deb2242dbfa6fbbfb4dcaac40e856bb01e
Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs
@@ -1,30 +1,47 @@
using UnityEngine;
//   只有主线战斗用到 所以这里可能会放一些主线的特殊处理
public class HandModeOperationAgent : IOperationAgent
{
   protected StoryBattleField storyBattleField;
   bool autoNext = false;   //预存玩家的下一次攻击,让下一次自动执行,因为玩家点的时机不一定是刚好的可攻击状态
   public HandModeOperationAgent(BattleField battleField) : base(battleField)
   {
      storyBattleField = battleField as StoryBattleField;
   }
   float lastTime;
   public override void Run()
   {
      base.Run();
      if (autoNext)
      {
         if (Time.time - lastTime < 0.1f)
            return;
         lastTime = Time.time;
         if (storyBattleField.RequestFight())
         {
            //直到成功为止
            autoNext = false;
         }
      }
   }
   //   通过主界面的按钮推动(调用)DoNext
   public override void DoNext()
   {
      base.DoNext();
      if (!battleField.recordPlayer.IsPlaying())
      if (!storyBattleField.RequestFight())
      {
         //   ask for next action
         autoNext = true;
      }
      else
      {
         Debug.LogError("action doesnt finish, wait a moment please");
      }
        {
            autoNext = false;
        }
   }
}