| | |
| | | protected BattleField battleField; |
| | | |
| | | private Queue<RecordAction> recordActionQueue = new Queue<RecordAction>(); |
| | | |
| | | protected RecordAction currentRecordAction; |
| | | |
| | | private bool isWaitingNextAction = false; |
| | | private float waitTimer = 0f; |
| | | private const float waitInterval = 1f; |
| | | |
| | | public void Init(BattleField _battleField) |
| | | { |
| | |
| | | |
| | | public virtual void Run() |
| | | { |
| | | // 等待下一个action |
| | | if (isWaitingNextAction) |
| | | { |
| | | waitTimer += Time.deltaTime; |
| | | if (waitTimer >= waitInterval) |
| | | { |
| | | isWaitingNextAction = false; |
| | | waitTimer = 0f; |
| | | } |
| | | else |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (currentRecordAction == null) |
| | | { |
| | | if (recordActionQueue.Count <= 0) |
| | |
| | | if (currentRecordAction != null && currentRecordAction.IsFinished()) |
| | | { |
| | | Debug.LogError("record action " + currentRecordAction.GetType() + " play finished"); |
| | | |
| | | currentRecordAction = null; |
| | | isWaitingNextAction = true; |
| | | waitTimer = 0f; |
| | | return; |
| | | } |
| | | |
| | | if (currentRecordAction == null) |