public void Play() { if (!mIsPlaying) { mIsPlaying = true; mCurrent = mHead; mCurrent.RunScript(); mCurrentTimes = 1; mCurrentTime = 0; mCurrentDelay = mCurrent.delay; mEmulator.Clear(); } }
public void Update(float deltaTime) { if (mIsPlaying && !mIsPaused) { if (mInterrupts.Count > 0) { for (int i = mInterrupts.Count - 1; i >= 0; i--) { if (!mInterrupts[i].isPlaying) { mInterrupts[i].Dispose(); mInterrupts.RemoveAt(i); } else { mInterrupts[i].Update(deltaTime); } } } else if (mSeriesQueue.Count > 0) { BBMacroPlayer player = mSeriesQueue.Dequeue(); player.Play(); mInterrupts.Add(player); } else if (mCurrent == null) { mIsPlaying = false; } else { if (mCurrentTime > 0) { mCurrentTime -= deltaTime; } else { mCurrentDelay -= deltaTime; } if (mEmulator.isPlaying) { mEmulator.Update(deltaTime); } else { while ((mCurrentDelay < 0 || mCurrentTime < 0) && !mEmulator.isPlaying && mInterrupts.Count == 0) { if (mCurrentTime < 0) { if (mCurrentTimes < mCurrent.times) { mCurrentTimes += 1; } else { mCurrent = mCurrent.next; if (mCurrent == null) { break; } } mCurrent.RunScript(); mCurrentDelay += mCurrent.delay; mCurrentDelay += mCurrentTime; mCurrentTime = 0; } if (mCurrentDelay < 0) { BBLoopAction action = BBLoopAction.Continue; Execute(mCurrent, out action); if (action == BBLoopAction.Continue) { mCurrentTime += mCurrent.duration; mCurrentTime += mCurrentDelay; } else if (action == BBLoopAction.Break) { mCurrentTimes = mCurrent.times; mCurrentTime = -float.Epsilon; } mCurrentDelay = 0; } } } } } }