Skip to content

Instantly share code, notes, and snippets.

@doublespoiler
Created February 6, 2017 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doublespoiler/9bf04014971bccbd6f0ba1408b72e72c to your computer and use it in GitHub Desktop.
Save doublespoiler/9bf04014971bccbd6f0ba1408b72e72c to your computer and use it in GitHub Desktop.
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