Exemplo n.º 1
0
        private static SpatialPartition TakeFromPool(Point position)
        {
            // Create new partition if there's none in the pool.
            if (partitionPool.Count < 1)
            {
                return(CreateNewPartition(position, true));
            }

            // Otherwise, return a partition that's in the pool.
            SpatialPartition partition = partitionPool.Array[partitionPool.Count - 1];

            partitions.Add(partition);
            partitionPool.Remove(partition);
            partition.UpdatePosition(position);
            partition.IsActive = true;
            return(partition);
        }