| | |
| | | |
| | | private float speedRatio = 1.5f; |
| | | |
| | | private bool isForceFinish = false; |
| | | |
| | | public void Init(BattleField _battleField) |
| | | { |
| | | Release(); |
| | |
| | | public void PlayRecord(RecordAction recordAction) |
| | | { |
| | | BattleDebug.LogError("Enqueue record action " + recordAction.GetType()); |
| | | if (isForceFinish) |
| | | { |
| | | recordAction.ForceFinish(); |
| | | return; |
| | | } |
| | | recordActionQueue.Enqueue(recordAction); |
| | | } |
| | | |
| | |
| | | |
| | | public void InsertRecord(RecordAction recordAction) |
| | | { |
| | | if (isForceFinish) |
| | | { |
| | | recordAction.ForceFinish(); |
| | | return; |
| | | } |
| | | |
| | | BattleDebug.LogError("Insert record action " + recordAction.GetType()); |
| | | if (currentRecordAction != null) |
| | | { |
| | |
| | | |
| | | public void ImmediatelyPlay(RecordAction recordAction) |
| | | { |
| | | if (isForceFinish) |
| | | { |
| | | recordAction.ForceFinish(); |
| | | return; |
| | | } |
| | | immediatelyActionList.Add(recordAction); |
| | | } |
| | | |
| | |
| | | |
| | | for (int i = removeIndexList.Count - 1; i >= 0; i--) |
| | | { |
| | | immediatelyActionList.RemoveAt(removeIndexList[i]); |
| | | int index = removeIndexList[i]; |
| | | if (index < 0 || index >= immediatelyActionList.Count) |
| | | continue; |
| | | immediatelyActionList.RemoveAt(index); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (currentRecordAction != null && currentRecordAction.IsFinished()) |
| | | { |
| | | var guid = currentRecordAction.GetBattleFieldGuid(); |
| | | BattleDebug.LogError("record action " + currentRecordAction.GetType() + " play finished"); |
| | | currentRecordAction = null; |
| | | isWaitingNextAction = true; |
| | | waitTimer = 0f; |
| | | EventBroadcast.Instance.Broadcast<string>(EventName.RECORDPLAYER_END, guid); |
| | | return; |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | public void HaveRest() |
| | | { |
| | | ForceFinish(); |
| | |
| | | |
| | | public void ForceFinish() |
| | | { |
| | | for (int i = 0; i < immediatelyActionList.Count; i++) |
| | | isForceFinish = true; |
| | | for (int i = immediatelyActionList.Count - 1; i >= 0; i--) |
| | | { |
| | | immediatelyActionList[i].ForceFinish(); |
| | | var action = immediatelyActionList[i]; |
| | | action.ForceFinish(); |
| | | immediatelyActionList.Remove(action); |
| | | } |
| | | |
| | | immediatelyActionList.Clear(); |
| | | |
| | | if (currentRecordAction != null) |
| | | while (currentRecordAction != null) |
| | | { |
| | | currentRecordAction.ForceFinish(); |
| | | var temp = currentRecordAction; |
| | | currentRecordAction = null; |
| | | temp.ForceFinish(); |
| | | } |
| | | currentRecordAction = null; |
| | | |
| | | while (recordActionQueue.Count > 0) |
| | | { |
| | |
| | | currentRecordAction = null; |
| | | recordActionQueue.Clear(); |
| | | immediatelyActionList.Clear(); |
| | | isForceFinish = false; |
| | | } |
| | | |
| | | public void SetSpeedRatio(float ratio) |