Example #1
0
        public void EmptyMap()
        {
            MapArea map = new MapArea (20, 0);

            Assert.AreEqual (0, map.height);
            Assert.AreEqual (0, map.width);
        }
Example #2
0
 public MapArea generate()
 {
     MapArea map = new MapArea (width, height);
     for (var y=0; y<height; y++) {
         for (var x=0; x<width; x++) {
             map.setHeightAt(x, y, RandomGenerator.generate(min, max));
         }
     }
     return map;
 }
Example #3
0
        public void MapArea()
        {
            MapArea map = new MapArea (10, 20);

            Assert.AreEqual (10, map.width);
            Assert.AreEqual (20, map.height);

            Assert.AreEqual (0, map.getHeightAt (0, 0));
            Assert.AreEqual (0, map.getHeightAt (9, 19));
            Assert.AreEqual (0, map.getHeightAt (7, 4));
            Assert.AreEqual (0, map.getHeightAt (5, 10));
        }
Example #4
0
 public void call(MapArea map)
 {
     int height = map.height;
     int width = map.width;
     for (var y=0; y<height; y++) {
         for (var x=0; x<width; x++) {
             float tile_h = map.getHeightAt(x, y);
             if ((greater_than && tile_h > h) || (!greater_than && tile_h < h)) {
                 map.setHeightAt(x, y, h);
             }
         }
     }
 }
Example #5
0
 public void call(MapArea map)
 {
     // do nothing!
 }
Example #6
0
 public void MapAreaWidthException()
 {
     MapArea map = new MapArea (3, 3);
     map.getHeightAt (3, 0);
 }
Example #7
0
 public void MapAreaHeightException()
 {
     MapArea map = new MapArea (3, 3);
     map.getHeightAt (0, 3);
 }