Wiki

Clone wiki

RogueSharp / RogueSharp / Map / README

Map Class

A Map represents a rectangular grid of Cells, each of which has a number of properties for determining walkability, field-of-view and so on The upper left corner of the Map is Cell (0,0) and the X value increases to the right, as the Y value increases downward

Inheritance Hierarchy

SystemObject
RogueSharpMap

Namespace: RogueSharp
Assembly:

Syntax

public class Map : IMap

The Map type exposes the following members.

Constructors

Name Description
Map Constructor creates a new uninitialized Map
Map(Int32, Int32) Constructor creates a new Map and immediately initializes it

Properties

Name Description
Height How many Cells tall the Map is
Width How many Cells wide the Map is

Methods

Name Description
AppendFov Performs a field-of-view calculation with the specified parameters and appends it any existing field-of-view calculations. Field-of-view (FOV) is basically a calculation of what is observable in the Map from a given Cell with a given light radius.
CellFor Get the Cell at the specified single dimensional array index using the formulas: x = index % Width; y = index / Width;
Clear Sets the properties of all Cells in the Map to be transparent and walkable
Clear(Boolean, Boolean) Sets the properties of all Cells in the Map to the specified values
Clone Create and return a deep copy of an existing Map
ComputeFov Performs a field-of-view calculation with the specified parameters. Field-of-view (FOV) is basically a calculation of what is observable in the Map from a given Cell with a given light radius. Any existing field-of-view calculations will be overwritten when calling this method.
Copy(IMap) Copies the Cell properties of a smaller source Map into this destination Map at location (0,0)
Copy(IMap, Int32, Int32) Copies the Cell properties of a smaller source Map into this destination Map at the specified location
Create Static factory method which creates a new Map using the specified IMapCreationStrategy
Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
GetAllCells Get an IEnumerable of all Cells in the Map
GetBorderCellsInArea Get an IEnumerable of the outermost border Cells in a square around the Origin Cell
GetBorderCellsInRadius Get an IEnumerable of the outermost border Cells in a circular Radius around the Origin Cell
GetCell Get a Cell at the specified location
GetCellsAlongLine Get an IEnumerable of Cells in a line from the Origin Cell to the Destination Cell The resulting IEnumerable includes the Origin and Destination Cells Uses Bresenham's line algorithm to determine which Cells are in the closest approximation to a straight line between the two Cells
GetCellsInArea Get an IEnumerable of Cells in a square area around the Origin Cell
GetCellsInColumns Get an IEnumerable of all the Cells in the specified column numbers
GetCellsInRadius Get an IEnumerable of Cells in a circular Radius around the Origin Cell
GetCellsInRows Get an IEnumerable of all the Cells in the specified row numbers
GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
GetType Gets the Type of the current instance. (Inherited from Object.)
IndexFor(Cell) Get the single dimensional array index for the specified Cell
IndexFor(Int32, Int32) Get the single dimensional array index for a Cell at the specified location using the formula: index = ( y * Width ) + x
Initialize Create a new map with the properties of all Cells set to false
IsExplored Check if the Cell is flagged as ever having been explored by the player
IsInFov Check if the Cell is in the currently computed field-of-view For newly initialized maps a field-of-view will not exist so all Cells will return false Field-of-view must first be calculated by calling ComputeFov and/or AppendFov
IsTransparent Get the transparency of the Cell i.e. if line of sight would be blocked by this Cell
IsWalkable Get the walkability of the Cell i.e. if a character could normally move across the Cell without difficulty
MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Restore Restore the state of this Map from the specified MapState
Save Get a MapState POCO which represents this Map and can be easily serialized Use Restore with the MapState to get back a full Map
SetCellProperties(Int32, Int32, Boolean, Boolean) Set the properties of an unexplored Cell to the specified values
SetCellProperties(Int32, Int32, Boolean, Boolean, Boolean) Set the properties of a Cell to the specified values
ToString Provides a simple visual representation of the map using the following symbols: - .: Cell is transparent and walkable - s: Cell is walkable (but not transparent) - o: Cell is transparent (but not walkable) - #: Cell is not transparent or walkable (Overrides ObjectToString.)
ToString(Boolean) Provides a simple visual representation of the map using the following symbols: - %: Cell is not in field-of-view - .: Cell is transparent, walkable, and in field-of-view - s: Cell is walkable and in field-of-view (but not transparent) - o: Cell is transparent and in field-of-view (but not walkable) - #: Cell is in field-of-view (but not transparent or walkable)

See Also

Reference

RogueSharp Namespace

[37]: 2014-2016 Faron Bracy

Updated