예제 #1
0
        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);
        }
예제 #2
0
 public virtual void Pause()
 {
     MonoMultiThread.PauseThreadWorker(ThreadKey);
     IsPlaying = false;
     IsPausing = true;
     Stopwatch.Stop();
 }
예제 #3
0
        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();
        }
예제 #4
0
        public virtual void Stop()
        {
            if (MonoMultiThread.IsContainPauseList(ThreadKey))
            {
                MonoMultiThread.ResumeThreadWorker(ThreadKey);
            }
            if (MonoMultiThread.IsContainThreadWorker(ThreadKey))
            {
                MonoMultiThread.DeleteThreadWorker(ThreadKey);
            }

            IsPlaying  = false;
            IsComplete = false;
            IsPausing  = false;
        }