Example #1
0
 private static void CarveRoom(ISettableMapView <bool> map, Rectangle room)
 {
     foreach (var position in map.Positions())
     {
         map[position] = true;
     }
 }
Example #2
0
        /// <summary>
        /// Sets all terrain on the current map to be equal to the corresponding values from the map view you pass in.  Equivalent to
        /// calling <see cref="SetTerrain(IGameObject)"/> once on each object in the map view you pass in.  If translation between
        /// the overlay and IGameObject is required, see the overloads of this function that take a translation function.
        /// </summary>
        /// <param name="overlay">
        /// Map view specifying the terrain apply to the map. Must have identical dimensions to the current map.
        /// </param>
        public void ApplyTerrainOverlay(IMapView <IGameObject> overlay)
        {
            if (Height != overlay.Height || Width != overlay.Width)
            {
                throw new ArgumentException("Overlay size must match current map size.");
            }

            foreach (var pos in _terrain.Positions())
            {
                SetTerrain(overlay[pos]);
            }
        }