public MapConsole(int width, int height)
: base(width, height)
{
// Create the map
IMapCreationStrategy<Map> mapCreationStrategy = new RandomRoomsMapCreationStrategy<Map>(width, height, 100, 15, 4);
map = Map.Create(mapCreationStrategy);
mapData = new SadConsole.CellAppearance[width, height];
foreach (var cell in map.GetAllCells())
{
if (cell.IsWalkable)
{
// Our local information about each map square
mapData[cell.X, cell.Y] = new MapObjects.Floor();
// Copy the appearance we've defined for Floor or Wall or whatever, to the actual console data that is rendered
mapData[cell.X, cell.Y].CopyAppearanceTo(this[cell.X, cell.Y]);
}
else
{
mapData[cell.X, cell.Y] = new MapObjects.Wall();
mapData[cell.X, cell.Y].CopyAppearanceTo(this[cell.X, cell.Y]);
}
}
// Create map effects
explored = new SadConsole.Effects.Recolor();
explored.Background = Color.White * 0.3f;
explored.Foreground = Color.White * 0.3f;
explored.Update(10d); // Trickery to force the fade to complete to the destination color.
// Entities
entities = new List<SadConsole.Game.GameObject>();
// Create the player
player = new Entities.Player();
var tempCell = GetRandomEmptyCell();
player.Position = new Microsoft.Xna.Framework.Point(tempCell.X, tempCell.Y);
player.RenderOffset = this.Position;
entities.Add(player);
// Create a hound
GenerateHound();
GenerateHound();
GenerateHound();
// Initial view
UpdatePlayerView();
// Keyboard setup
SadConsole.Engine.Keyboard.RepeatDelay = 0.07f;
SadConsole.Engine.Keyboard.InitialRepeatDelay = 0.1f;
}