Esempio n. 1
0
        /// <summary>
        /// Stops the coroutine.
        /// </summary>
        /// <param name="callback">Still send a callback if coroutine finished by this.</param>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        private void Stop(bool callback)
        {
            switch (Status)
            {
            case CoroutineStatus.Running:
            case CoroutineStatus.Paused:
                Root.StopCoroutine(coroutine);
                Status = CoroutineStatus.Finished;
                if (callback)
                {
                    OnFinish();
                }
                break;

            case CoroutineStatus.NotStarted:
                BulletStormLogger.LogWarning("Coroutine not started.");
                break;

            case CoroutineStatus.Finished:
                BulletStormLogger.Log("Coroutine already finished.");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Pauses the coroutine.
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        public void Pause()
        {
            switch (Status)
            {
            case CoroutineStatus.Running:
                Status = CoroutineStatus.Paused;
                break;

            case CoroutineStatus.NotStarted:
                BulletStormLogger.LogWarning("Coroutine not started.");
                break;

            case CoroutineStatus.Paused:
                BulletStormLogger.Log("Coroutine already paused.");
                break;

            case CoroutineStatus.Finished:
                BulletStormLogger.LogWarning("Coroutine is finished.");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }