public void Start() { _data.Initialize(1); ProgressChanged.SafeRaise(this, _data); _isRun = true; _currCoroutine = _coroutine.StartCoroutine(Progress()); }
IEnumerator Progress() { while (_isRun) { var max = Mathf.Max(2, UnityEngine.Random.value * MAX_TIME); var current = max; while (current >= 0) { _data.Initialize(current / max); ProgressChanged.SafeRaise(this, _data); current -= Time.deltaTime; yield return(null); } ProgressDone.SafeRaise(this, EventArgs.Empty); yield return(null); } }