private void StartInternal() { Print("Script starting"); OnStart(); MainThread = new ScriptThread(new Action(OnTick)); OnStarted(); }
private void TerminateInternal(string message = "Script terminated") { OnTerminate(); IsRunning = false; MainThread = null; ThreadPool.Clear(); Print(message); OnTerminated(); }
protected ScriptThread StartThread(Action action) { var thread = new ScriptThread(action); ThreadPool.Add(thread); return thread; }