public void UpdateScripts(GameTime gameTime) { bool updateGame = true; foreach (Script script in RunningScripts) { // Update the run status of the script script.CheckCanRun(); if (script.CanRun || script.Running) { // If we can run it, we update the script script.Run(gameTime); script.CheckDone(); if (script.Done) { ScriptsToRemove.Add(script); } script.CheckShouldUpdateGame(); updateGame = updateGame && script.ShouldUpdateGame; } } foreach (Script script in ScriptsToRemove) { RunningScripts.Remove(script); } ScriptsToRemove.Clear(); UpdateGame = updateGame; }
public void LoadAndAddScripts(ContentManager content) { foreach (Script script in ScriptsToAdd) { script.LoadAndInit(content); RunningScripts.Add(script); } ScriptsToAdd.Clear(); }