public Map(int width, int height) { cells = new Cell[width, height]; bounds = new Rectangle(0, 0, width, height); for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { cells[x, y] = new Cell(); cells[x, y].Column = x; cells[x, y].Row = y; } } }
public Room(int Width, int Height) : base(Width, Height) { cells = new Cell[Width, Height]; bounds = new Rectangle(0, 0, Width, Height); for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { Cell cell = new Cell(); cell.WestSide = (x == 0) ? Cell.Sidetype.Wall : Cell.Sidetype.Empty; cell.EastSide = (x == Width - 1) ? Cell.Sidetype.Wall : Cell.Sidetype.Empty; cell.NorthSide = (y == 0) ? Cell.Sidetype.Wall : Cell.Sidetype.Empty; cell.SouthSide = (y == Height - 1) ? Cell.Sidetype.Wall : Cell.Sidetype.Empty; this[x, y] = cell; } } }
public Point CreateSide(Point currentLocation, Direction.DirectionType direction, Cell.Sidetype sidetype) { Point targetLocation = new Point(); targetLocation = GetTargetLocation(currentLocation, direction); switch (direction) { case Direction.DirectionType.North: this[currentLocation].NorthSide = sidetype; this[targetLocation].SouthSide = sidetype; break; case Direction.DirectionType.South: this[currentLocation].SouthSide = sidetype; this[targetLocation].NorthSide = sidetype; break; case Direction.DirectionType.East: this[currentLocation].EastSide = sidetype; this[targetLocation].WestSide = sidetype; break; case Direction.DirectionType.West: this[currentLocation].WestSide = sidetype; this[targetLocation].EastSide = sidetype; break; } return targetLocation; }