Ejemplo n.º 1
0
 public bool Get(IntVector3 candidate, out T item)
 {
     if (candidate.Equal(center) || CubeNeighbors6.IsNeighbor(center, candidate))
     {
         if (storage.ContainsKey(candidate))
         {
             item = storage[candidate];
             return(true);
         }
     }
     item = default(T);
     return(false);
 }
Ejemplo n.º 2
0
 public bool Set(IntVector3 candidate, T item)
 {
     if (CubeNeighbors6.IsNeighbor(center, candidate) || candidate.Equal(center))
     {
         if (storage.ContainsKey(candidate))
         {
             storage[candidate] = item;
         }
         else
         {
             storage.Add(candidate, item);
         }
         return(true);
     }
     item = default(T);
     return(false);
 }
Ejemplo n.º 3
0
 public T this[IntVector3 key] {
     get {
         if (storage.ContainsKey(key))
         {
             return(storage[key]);
         }
         return(default(T));
     }
     set {
         if (storage.ContainsKey(key))
         {
             storage[key] = value;
         }
         else if (center.Equal(key) || CubeNeighbors6.IsNeighbor(center, key))
         {
             storage.Add(key, value);
         }
     }
 }
Ejemplo n.º 4
0
        public bool Next(out IntVector3 chunkPos)
        {
            if (!currentCenter.Equal(chunkLocation))
            {
                resetIterator();
            }

            while (true)
            {
                if (iterator.Next(out chunkPos))
                {
                    chunkPos += currentCenter;
                    if (!IsLiveOrEnqueued(chunkPos))
                    {
                        return(true);
                    }
                }
                else
                {
                    return(false);
                }
            }
        }