/// <summary> Constructor. </summary>
        /// <exception cref="ArgumentNullException"> Thrown when one or more required arguments are null. </exception>
        /// <param name="worldGrid"> The world grid which should provide the grid data to be watched. </param>
        /// <param name="numUnitsWide"> How many units wide the area that should be watched. </param>
        /// <param name="numUnitsHigh"> How many units high the area that should be watched. </param>
        public WorldGridSlice(WorldGrid worldGrid, int numUnitsWide, int numUnitsHigh)
        {
            if (worldGrid == null)
            {
                throw new ArgumentNullException(nameof(worldGrid));
            }

            numUnitsWide *= GridCoordinate.WorldToGridMultiplier;
            numUnitsHigh *= GridCoordinate.WorldToGridMultiplier;

            // we always need to be odd (isn't that a statement of life)
            MathUtil.MakeOdd(ref numUnitsWide);
            MathUtil.MakeOdd(ref numUnitsHigh);

            // let's make sure we always have valid values
            numUnitsWide = Math.Max(numUnitsWide, 5);
            numUnitsHigh = Math.Max(numUnitsHigh, 5);

            _worldGrid        = worldGrid;
            _visibleGridItems = new Array2D <SliceUnitData <T> >(numUnitsWide, numUnitsHigh);
            _chunkTracker     = new ChunkTracker();

            // these are used for converting an array index back into a world coordinate
            _numUnitsWideHalfThreshold = (_visibleGridItems.Width - 1) / 2;
            _numUnitsHighHalfThreshold = (_visibleGridItems.Height - 1) / 2;
        }
 /// <summary> Constructor. </summary>
 /// <param name="position"> The position of the given chunk. </param>
 public Chunk(ChunkCoordinate position)
 {
     Position      = position;
     _items        = new UnsafeGridItemArray(NumberOfGridItemsWide * NumberOfGridItemsHigh);
     AbsoluteIndex = WorldGrid.CalculateAbsoluteChunkIndex(Position.X, Position.Y);
 }