public void ExecuteScript(MiScript script) { MiScriptState scriptState = new MiScriptState(script); if (!scriptState.IsComplete()) { activeScripts.Add(scriptState); } }
public MiScriptState(MiScript script) { scriptEnumerator = script(); if (scriptEnumerator == null) { this.script = null; } else { this.script = script; sleepTime = scriptEnumerator.Current; } }
public void Execute(GameTime gameTime) { if (sleepTime > 0) { sleepTime--; } if (sleepTime <= 0) { bool unfinished = false; do { unfinished = scriptEnumerator.MoveNext(); sleepTime = scriptEnumerator.Current; }while (sleepTime <= 0 && unfinished); if (!unfinished) { script = null; } } }