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/ec6b255a2d1a864b0a54c0b4ad6f2529 to your computer and use it in GitHub Desktop.
Save doublespoiler/ec6b255a2d1a864b0a54c0b4ad6f2529 to your computer and use it in GitHub Desktop.
Could not load type RogueSharp.Map
using RLNET;
using RogueSharpTut.Core;
using RogueSharp;
namespace RogueSharpTut.Systems
{
public class MapGenerator
{
private readonly int _width;
private readonly int _height;
private readonly DungeonMap _map;
//Constructing a new MapGenerator requires dimensions of the map it will make
public MapGenerator(int width, int height)
{
_width = width;
_height = height;
_map = new DungeonMap();
}
//Generate a newmap that is a simple open floor with walls around the outside
public DungeonMap CreateMap()
{
//Initialize very cell in the map by setting walkable/transparency/explored to true
_map.Initialize(_width, _height);
foreach (Cell cell in _map.GetAllCells())
{
_map.SetCellProperties(cell.X, cell.Y, true, true, true);
}
//Set first and last rows to not be transparent or walkable
foreach (Cell cell in _map.GetCellsInRows(0, _height -1))
{
_map.SetCellProperties(cell.X, cell.Y, false, false, true);
}
//Set the first and last columns in map to not be transparent or walkable
foreach(Cell cell in _map.GetCellsInColumns(0, _width - 1 ))
{
_map.SetCellProperties(cell.X, cell.Y, false, false, true);
}
return _map;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment