Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Could not load type RogueSharp.Map
using RogueSharp;
using RLNET;
namespace RogueSharpTut.Core
{
//Custom DungeonMap class that extends the base RogueSharp map (class Name : Map)
public class DungeonMap : Map
{
//The Draw method will be called each time the map is updated
//It will render all symbols/colors for each cell to the map console
public void Draw(RLConsole mapConsole)
{
mapConsole.Clear();
foreach (Cell cell in GetAllCells())
{
SetConsoleSymbolForCell(mapConsole, cell);
}
}//end of draw
private void SetConsoleSymbolForCell(RLConsole console, Cell cell)
{
//When we haven't explored a cell yet, don't draw anything
if(!cell.IsExplored)
{
return;
}
//When a cell is in FoV, it should be drawn with lighter colors
if(IsInFov(cell.X, cell.Y))
{
//Choose the symbol to draw based on if it walkable or not
//'.' for floor, '#' for walls
if (cell.IsWalkable)
{
console.Set(cell.X, cell.Y, Colors.FloorFov, Colors.FloorBackgroundFov, '.');
} else
{
console.Set(cell.X, cell.Y, Colors.WallFov, Colors.WallBackgroundFov, '#');
}
}
//When a cell is outdside fov draw in darker colors
else
{
if (cell.IsWalkable)
{
console.Set(cell.X, cell.Y, Colors.Floor, Colors.FloorBackground, '.');
}
else
{
console.Set(cell.X, cell.Y, Colors.Wall, Colors.WallBackground, '#');
}
}
}// end SetConsoleSymbolforCell
}//end of DungeonMap
}//end of namespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment