RogueSharp
Show / Hide Table of Contents

Class Cell

A class that defines a square on a Map with all of its associated properties

Inheritance
System.Object
Cell
Implements
ICell
System.IEquatable<ICell>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: RogueSharp
Assembly: RogueSharp.dll
Syntax
public class Cell : ICell, IEquatable<ICell>

Constructors

| Improve this Doc View Source

Cell(Int32, Int32, Boolean, Boolean, Boolean)

Construct a new unexplored Cell located at the specified x and y location with the specified properties

Declaration
public Cell(int x, int y, bool isTransparent, bool isWalkable, bool isInFov)
Parameters
Type Name Description
System.Int32 x

X location of the Cell starting with 0 as the farthest left

System.Int32 y

Y location of the Cell starting with 0 as the top

System.Boolean isTransparent

Is there a clear line-of-sight through this Cell

System.Boolean isWalkable

Could a character could normally walk across the Cell without difficulty

System.Boolean isInFov

Is the Cell currently in the currently observable field-of-view

| Improve this Doc View Source

Cell(Int32, Int32, Boolean, Boolean, Boolean, Boolean)

Construct a new Cell located at the specified x and y location with the specified properties

Declaration
public Cell(int x, int y, bool isTransparent, bool isWalkable, bool isInFov, bool isExplored)
Parameters
Type Name Description
System.Int32 x

X location of the Cell starting with 0 as the farthest left

System.Int32 y

Y location of the Cell starting with 0 as the top

System.Boolean isTransparent

Is there a clear line-of-sight through this Cell

System.Boolean isWalkable

Could a character could normally walk across the Cell without difficulty

System.Boolean isInFov

Is the Cell currently in the currently observable field-of-view

System.Boolean isExplored

Has this Cell ever been explored by the player

Properties

| Improve this Doc View Source

IsExplored

Check if the Cell is flagged as ever having been explored by the player

Declaration
public bool IsExplored { get; }
Property Value
Type Description
System.Boolean
Remarks

The explored property of a Cell can be used to track if the Cell has ever been in the field-of-view of a character controlled by the player This property will not automatically be updated based on FOV calculations or any other built-in functions of the RogueSharp library.

Examples

As the player moves characters around a Map, Cells will enter and exit the currently computed field-of-view This property can be used to keep track of those Cells that have been "seen" and could be used to show fog-of-war type effects when rendering the map

| Improve this Doc View Source

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

Declaration
public bool IsInFov { get; }
Property Value
Type Description
System.Boolean
Remarks

Field-of-view (FOV) is basically a calculation of what is observable in the Map from a given Cell with a given light radius

Examples

Field-of-view can be used to simulate a character holding a light source and exploring a Map representing a dark cavern Any Cells within the FOV would be what the character could see from their current location and lighting conditions

| Improve this Doc View Source

IsTransparent

Get the transparency of the Cell i.e. if line of sight would be blocked by this Cell

Declaration
public bool IsTransparent { get; }
Property Value
Type Description
System.Boolean
Examples

A Cell representing an empty stone floor would be transparent A Cell representing a glass wall could be transparent (even though it may not be walkable) A Cell representing a solid stone wall would not be transparent

| Improve this Doc View Source

IsWalkable

Get the walkability of the Cell i.e. if a character could normally move across the Cell without difficulty

Declaration
public bool IsWalkable { get; }
Property Value
Type Description
System.Boolean
Examples

A Cell representing an empty stone floor would be walkable A Cell representing a glass wall may not be walkable (even though it could be transparent) A Cell representing a solid stone wall would not be walkable

| Improve this Doc View Source

X

Gets the X location of the Cell starting with 0 as the farthest left

Declaration
public int X { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Y

Y location of the Cell starting with 0 as the top

Declaration
public int Y { get; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

Equals(ICell)

Determines whether two Cell instances are equal

Declaration
public bool Equals(ICell other)
Parameters
Type Name Description
ICell other

The Cell to compare this instance to

Returns
Type Description
System.Boolean

True if the instances are equal; False otherwise

| Improve this Doc View Source

Equals(Object)

Determines whether two Cell instances are equal

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The Object to compare this instance to

Returns
Type Description
System.Boolean

True if the instances are equal; False otherwise

Overrides
System.Object.Equals(System.Object)
| Improve this Doc View Source

GetHashCode()

Gets the hash code for this object which can help for quick checks of equality or when inserting this Cell into a hash-based collection such as a Dictionary or Hashtable

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

An integer hash used to identify this Cell

Overrides
System.Object.GetHashCode()
| Improve this Doc View Source

ToString()

Provides a simple visual representation of the Cell 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
Declaration
public override string ToString()
Returns
Type Description
System.String

A string representation of the Cell using special symbols to denote Cell properties

Overrides
System.Object.ToString()
Remarks

This call ignores field-of-view. If field-of-view is important use the ToString overload with a "true" parameter

| Improve this Doc View Source

ToString(Boolean)

Provides a simple visual representation of the Cell 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)
Declaration
public string ToString(bool useFov)
Parameters
Type Name Description
System.Boolean useFov

True if field-of-view calculations will be used when creating the string representation of the Cell. False otherwise

Returns
Type Description
System.String

A string representation of the Cell using special symbols to denote Cell properties

Operators

| Improve this Doc View Source

Equality(Cell, Cell)

Determines whether two Cell instances are equal

Declaration
public static bool operator ==(Cell left, Cell right)
Parameters
Type Name Description
Cell left

Cell on the left side of the equal sign

Cell right

Cell on the right side of the equal sign

Returns
Type Description
System.Boolean

True if a and b are equal; False otherwise

| Improve this Doc View Source

Inequality(Cell, Cell)

Determines whether two Cell instances are not equal

Declaration
public static bool operator !=(Cell left, Cell right)
Parameters
Type Name Description
Cell left

Cell on the left side of the equal sign

Cell right

Cell on the right side of the equal sign

Returns
Type Description
System.Boolean

True if a and b are not equal; False otherwise

Implements

ICell
System.IEquatable<T>
  • Improve this Doc
  • View Source
RogueSharp © 2014-2020 Faron Bracy
Back to top