public new void StopAllCoroutines() { RadicalCoroutineManager manager = this.GetComponent <RadicalCoroutineManager>(); if (manager != null) { manager.PurgeCoroutines(this); } base.StopAllCoroutines(); }
internal void Resume(MonoBehaviour behaviour) { if (_state != RadicalCoroutineOperatingState.Inactive && _state != RadicalCoroutineOperatingState.Paused) throw new System.InvalidOperationException("Failed to start RadicalCoroutine. The Coroutine is already being processed."); if (behaviour == null) throw new System.ArgumentNullException("behaviour"); _state = RadicalCoroutineOperatingState.Active; _owner = behaviour; if (_stack.CurrentOperation is IPausibleYieldInstruction) (_stack.CurrentOperation as IPausibleYieldInstruction).OnResume(); #if SP_LIB var manager = behaviour.AddOrGetComponent<RadicalCoroutineManager>(); #else var manager = behaviour.GetComponent<RadicalCoroutineManager>(); if (manager == null) manager = behaviour.gameObject.AddComponent<RadicalCoroutineManager>(); #endif _manager = manager; _manager.RegisterCoroutine(this); _token = behaviour.StartCoroutine(this); }
/// <summary> /// Should only be ever called from RadicalCoroutineManager. /// </summary> /// <param name="cancelledByManager"></param> internal void Cancel(bool cancelledByManager) { _state = RadicalCoroutineOperatingState.Cancelling; if (cancelledByManager) { _manager = null; } }
public void StartAsync(MonoBehaviour behaviour, RadicalCoroutineDisableMode disableMode = RadicalCoroutineDisableMode.Default) { if (_state != RadicalCoroutineOperatingState.Inactive) throw new System.InvalidOperationException("Failed to start RadicalCoroutine. The Coroutine is already being processed."); if (behaviour == null) throw new System.ArgumentNullException("behaviour"); _state = RadicalCoroutineOperatingState.Active; _owner = behaviour; _disableMode = disableMode; if (_stack.CurrentOperation is IPausibleYieldInstruction) (_stack.CurrentOperation as IPausibleYieldInstruction).OnResume(); _stack.Push(com.spacepuppy.Async.RadicalTask.Create(this)); //we start the task as an async operation #if SP_LIB var manager = behaviour.AddOrGetComponent<RadicalCoroutineManager>(); #else var manager = behaviour.GetComponent<RadicalCoroutineManager>(); if (manager == null) manager = behaviour.gameObject.AddComponent<RadicalCoroutineManager>(); #endif _manager = manager; _manager.RegisterCoroutine(this); _token = behaviour.StartCoroutine(this); }