public IEnumerator Convert() { // check if this is totally out of bounds if (m_voxelStart.x >= m_manager.m_blob.width || m_voxelStart.y >= m_manager.m_blob.height || m_voxelStart.z >= m_manager.m_blob.depth || m_voxelEnd.x < 0 || m_voxelEnd.y < 0 || m_voxelEnd.z < 0) { if (m_delta != null) { m_delta.MarkConversionDone(); } gameObject.SetActive(false); Destroy(gameObject); yield break; } /// Create an Octree for the altered faces m_meshOctree = new Octree(0, m_data.faces, m_lowerBound, m_upperBound); if (m_delta == null) { m_delta = new MeshPatternDelta(this, m_data, m_manager.chunkSize); m_manager.PushNewDelta(m_delta); } if (Scheduler.ShouldYield()) { yield return(null); } if (shouldAbort) { yield break; } IWaitCondition[] waitConds = new IWaitCondition[3]; for (int dir = 0; dir < 3; ++dir) { waitConds[dir] = new WaitCoroutine(Scheduler.StartCoroutine(CreateVoxelsFromDirection(dir))); } yield return(new WaitAll(waitConds)); if (!shouldAbort) { m_delta.MarkConversionDone(); } gameObject.SetActive(false); Destroy(gameObject); Dispatcher.RemoveListener(MenuController.kEventNewBlob, CancelConversion); }
internal void Update() { if (Status != CoroutineStatus.Running) { return; } IWaitCondition currentYield = _enumerator.Current; if (currentYield == null || currentYield.Update()) { if (!_enumerator.MoveNext()) { Status = CoroutineStatus.Complete; } } }
/// <summary> /// Figures out when the next time we should run. /// </summary> /// <param name='status'> /// The object returned from a yield /// </param> /// <exception cref='System.Exception'> /// Will throw an exception if we get a yield object we don't recognize /// </exception> void UpdateNextRunStatus(object status) { //potential TODO: Support a version of WaitForFixedUpdate and WaitForEndOfFrame if (status == null) { m_waitCondition = new WaitFrames(1); } else if (typeof(IWaitCondition).IsAssignableFrom(status.GetType())) { m_waitCondition = (IWaitCondition)status; } else if (status.GetType() == typeof(RCECoroutine)) { m_waitCondition = new WaitCoroutine((RCECoroutine)status); } else if (status.GetType() == typeof(WaitForSeconds)) { throw new System.Exception("Don't use WaitForSeconds. Use WaitSeconds instead."); } else { throw new System.Exception("Unhandled yield type to RCECoroutine: " + status.ToString()); } }
private FluentCondition(IWaitCondition condition) { this.currentCondition = condition; }
private static bool EvaluateWaitCondition <T>(this IWaitCondition <T> condition, T elements) { return(condition.GetCondition().Invoke(elements)); }
public ExclusiveCondition(IWaitCondition leftCondition, IWaitCondition rightCondition) : base(leftCondition, rightCondition) { }
public DisjunctionCondition(IWaitCondition leftCondition, IWaitCondition rightCondition) : base(leftCondition, rightCondition) { }
public ConjuctionCondition(IWaitCondition leftCondition, IWaitCondition rightCondition) : base(leftCondition, rightCondition) { }
protected BinaryCondition(IWaitCondition leftCondition, IWaitCondition rightCondition) { this.leftCondition = leftCondition; this.rightCondition = rightCondition; }
public OppositeCondition(IWaitCondition condition) { this.innerCondition = condition; }