예제 #1
0
 public Map(int width = 900, int height = 500)
 {
     // Init
     SizeX = width;
     SizeY = height;
     Types = new BlockType[30];
     WallTypes = new WallType[10];
     Blocks = new Block[SizeX, SizeY];
     Walls = new Wall[SizeX, SizeY];
     DroppedItems = new DroppedItemCollection();
     Fluids = new Fluid.FluidCollection();
     Entities = new EntityPackage();
     Flora = new FloraPackage();
     WallTypes[0] = new WallType(1, "Standard Wall", new Rectangle(0,0,24,24));
 }
예제 #2
0
 public Wall(WallType type)
 {
     Health = 100;
     Type = type;
 }
예제 #3
0
        public bool placeWall(int x, int y, WallType type)
        {
            if (getWall(x, y) != null) { return false; }

            // Check for walls or block to attach to
            if (getWall(x - 1, y) == null && getWall(x + 1, y) == null && getWall(x, y - 1) == null && getWall(x, y + 1) == null && getBlock(x - 1, y) == null && getBlock(x + 1, y) == null && getBlock(x, y - 1) == null && getBlock(x, y + 1) == null)
            {
                return false;
            }

            // Check range from player

            Walls[x, y] = new Wall(type);
            return true;
        }