示例#1
0
        public void Start()
        {
            if (IsRunning)
            {
                return;
            }

            // Start coroutine.
            timerCoroutine = UnityThread.StartCoroutine(TimerRoutine());
        }
示例#2
0
        public void Pause()
        {
            if (!IsRunning)
            {
                return;
            }

            // Stop coroutine.
            UnityThread.StopCoroutine(timerCoroutine);
            timerCoroutine = null;
        }
        /// <summary>
        /// Starts running the async operation.
        /// </summary>
        private void StartRunner()
        {
            curOperation = runner?.Invoke();
            if (curOperation == null)
            {
                SetProgress(1f);
                SetFinished();
                return;
            }

            UnityThread.StartCoroutine(PollProgress());
            curOperation.completed += OnOperationComplete;
        }