private void Start() { var watch = Stopwatch.StartNew(); watch.Stop(); watch.Reset(); MonoMultiThread.InsertThreadWorker( data => { var dataToUse = (float)data; dataToUse += watch.ElapsedTicks / 10000000f; watch.Restart(); Debug.Log(dataToUse); return(dataToUse); }, data => { var dataToUse = (float)data; if (dataToUse >= 10) { // Destroy(gameObject); } else { return(false); } return(true); }, 0f); }
public virtual void Pause() { MonoMultiThread.PauseThreadWorker(ThreadKey); IsPlaying = false; IsPausing = true; Stopwatch.Stop(); }
public override void Play() { if (IsPlaying) { return; } if (ThreadKey != -999) { if (MonoMultiThread.IsContainThreadWorker(ThreadKey) && MonoMultiThread.IsContainPauseList(ThreadKey)) { MonoMultiThread.ResumeThreadWorker(ThreadKey); Stopwatch.Start(); } else { ThreadKey = MonoMultiThread.InsertThreadWorker(WorkerThreadAction, MainThreadAction, 0, ThreadKey); } } else { ThreadKey = MonoMultiThread.InsertThreadWorker(WorkerThreadAction, MainThreadAction, 0); } base.Play(); }
public virtual void Stop() { if (MonoMultiThread.IsContainPauseList(ThreadKey)) { MonoMultiThread.ResumeThreadWorker(ThreadKey); } if (MonoMultiThread.IsContainThreadWorker(ThreadKey)) { MonoMultiThread.DeleteThreadWorker(ThreadKey); } IsPlaying = false; IsComplete = false; IsPausing = false; }