예제 #1
0
        IEnumerator <GoObject> IEnumerable <GoObject> .GetEnumerator()
        {
            GoLayerEnumerator goLayerEnumerator = this;

            goLayerEnumerator.Reset();
            return(goLayerEnumerator);
        }
예제 #2
0
        /// <summary>
        /// Gets an enumerator for iterating over the GoObjects in this layer.
        /// </summary>
        public GoLayerEnumerator GetEnumerator()
        {
            GoLayerEnumerator result = this;

            result.Reset();
            return(result);
        }
예제 #3
0
        IEnumerator IEnumerable.GetEnumerator()
        {
            GoLayerEnumerator goLayerEnumerator = this;

            goLayerEnumerator.Reset();
            return(goLayerEnumerator);
        }
예제 #4
0
 internal GoLayerCollectionObjectEnumerator(List <GoLayer> a, bool forward)
 {
     myArray           = a;
     myForward         = forward;
     myIndex           = -1;
     myEnumerator      = GoLayerEnumerator.Empty;
     myEnumeratorValid = false;
     Reset();
 }
예제 #5
0
 /// <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);
     }
 }