IEnumerator <GoObject> IEnumerable <GoObject> .GetEnumerator() { GoLayerEnumerator goLayerEnumerator = this; goLayerEnumerator.Reset(); return(goLayerEnumerator); }
/// <summary> /// Gets an enumerator for iterating over the GoObjects in this layer. /// </summary> public GoLayerEnumerator GetEnumerator() { GoLayerEnumerator result = this; result.Reset(); return(result); }
IEnumerator IEnumerable.GetEnumerator() { GoLayerEnumerator goLayerEnumerator = this; goLayerEnumerator.Reset(); return(goLayerEnumerator); }
internal GoLayerCollectionObjectEnumerator(List <GoLayer> a, bool forward) { myArray = a; myForward = forward; myIndex = -1; myEnumerator = GoLayerEnumerator.Empty; myEnumeratorValid = false; Reset(); }
/// <summary> /// Advance the enumerator to the next GoObject in the whole collection of layers of GoObjects. /// </summary> /// <returns>True if there is a next GoObject; false if it has finished iterating over the collection.</returns> public bool MoveNext() { if (myEnumeratorValid) { if (myEnumerator.MoveNext()) { return(true); } myEnumeratorValid = false; } checked { if (myForward) { while (myIndex + 1 < myArray.Count) { myIndex++; GoLayer goLayer = myArray[myIndex]; myEnumerator = goLayer.GetEnumerator(); myEnumeratorValid = true; if (myEnumerator.MoveNext()) { return(true); } } return(false); } while (myIndex - 1 >= 0) { myIndex--; GoLayer goLayer2 = myArray[myIndex]; myEnumerator = goLayer2.Backwards; myEnumeratorValid = true; if (myEnumerator.MoveNext()) { return(true); } } return(false); } }