C# Class Descent.Model.Board.Board

A board of
显示文件 Open project: nezbo/Descent Class Usage Examples

Public Methods

Method Description
AddDoor ( Door door ) : void

Adds a door to the board

Board ( int width, int height, Microsoft.Xna.Framework.Graphics.Texture2D floorTexture ) : System

Initializes a new instance of the Board class.

CanFigureMoveToPoint ( Figure figure, Point point ) : bool

Gets a value indicating whether a figure can move to a point

CanOverlordSpawn ( Point point ) : bool

Indicates whether the overlord can spawn on a space

Distance ( Point here, Point there ) : int

Get the distance between to squares. This distance does not take blocking into account, such has there being a wall in the way

FigureSquares ( Figure figure ) : Point[]

Creates an array of all points a figure is on

IsSquareWithinBoard ( Point point ) : bool

Determines whether the point is within the board, and if there is a square on that point.

IsSquareWithinBoard ( int x, int y ) : bool

Determines wether the point (x, y) is within the board, and a square in the dungeon

IsStandable ( Point points ) : bool

Is all points in the array standable?

IsStandable ( int x, int y ) : bool

Is the square inside the dungeon, and is there no figure?

IsThereLineOfSight ( Figure from, Figure to, bool ignoreMonsters ) : bool

Indicates whethere there's nothing in the way from one figure to another. Can ignore monsters.

IsThereLineOfSight ( Point from, Point to, bool ignoreMonsters ) : bool

Indicates whether there is nothing in the way from one point to another Monsters can be ignored, so it can be used to calculate where to spawn monsters

IsValidStartSquare ( Point point ) : bool

Indicates whether a point is a valid start/spawn point

MoveFigure ( Figure figure, Point point ) : void

Moves a figure to a specific point.

OpenDoor ( Point point ) : void

Open a door

PlaceFigure ( Figure figure, Point point ) : void

Places a figure at a specific point

RespawnDeadHeroes ( ) : void

Respawns a dead hero next to the start glyph

SquareVisibleByPlayers ( int x, int y ) : bool

Should the square be shown on the board? A square is visible by players if it has something on it, and if that squares area has been revealed

this ( Point p ) : Square

Access a point on the board

this ( int x, int y ) : Square

Access the (x, y)'th in the board

Private Methods

Method Description
CanOpenDoor ( Point point ) : bool
GetDoor ( Point point ) : Door

Gets a door at a specific point, if there is any

PlaceDeadHero ( Hero hero ) : void
RemoveFigure ( Point point ) : void

Removes a figure from all squares where it was previously on the board

SquaresBetweenPoints ( Point from, Point to ) : Point[]

Get a (non-sorted) array of squares between two squares.

UpdateCanSpawn ( ) : void

Method Details

AddDoor() public method

Adds a door to the board
public AddDoor ( Door door ) : void
door Door /// The door to be added ///
return void

Board() public method

Initializes a new instance of the Board class.
public Board ( int width, int height, Microsoft.Xna.Framework.Graphics.Texture2D floorTexture ) : System
width int /// The width of the board ///
height int /// The height of the board ///
floorTexture Microsoft.Xna.Framework.Graphics.Texture2D /// The floor Texture. ///
return System

CanFigureMoveToPoint() public method

Gets a value indicating whether a figure can move to a point
public CanFigureMoveToPoint ( Figure figure, Point point ) : bool
figure Descent.Model.Player.Figure.Figure /// The figure ///
point Point /// The upper left corner of the end point ///
return bool

CanOverlordSpawn() public method

Indicates whether the overlord can spawn on a space
public CanOverlordSpawn ( Point point ) : bool
point Point /// The point ///
return bool

Distance() public method

Get the distance between to squares. This distance does not take blocking into account, such has there being a wall in the way
public Distance ( Point here, Point there ) : int
here Point /// The 'here' point ///
there Point /// The 'there' point ///
return int

FigureSquares() public method

Creates an array of all points a figure is on
public FigureSquares ( Figure figure ) : Point[]
figure Descent.Model.Player.Figure.Figure /// The figure ///
return Point[]

IsSquareWithinBoard() public method

Determines whether the point is within the board, and if there is a square on that point.
public IsSquareWithinBoard ( Point point ) : bool
point Point /// The point. ///
return bool

IsSquareWithinBoard() public method

Determines wether the point (x, y) is within the board, and a square in the dungeon
public IsSquareWithinBoard ( int x, int y ) : bool
x int /// The x coordinate ///
y int /// The y coordinate ///
return bool

IsStandable() public method

Is all points in the array standable?
public IsStandable ( Point points ) : bool
points Point
return bool

IsStandable() public method

Is the square inside the dungeon, and is there no figure?
public IsStandable ( int x, int y ) : bool
x int /// The x coordinate ///
y int /// The y coordinate ///
return bool

IsThereLineOfSight() public method

Indicates whethere there's nothing in the way from one figure to another. Can ignore monsters.
public IsThereLineOfSight ( Figure from, Figure to, bool ignoreMonsters ) : bool
from Descent.Model.Player.Figure.Figure "From" figure.
to Descent.Model.Player.Figure.Figure "To" figure.
ignoreMonsters bool Will ignore monsters if true.
return bool

IsThereLineOfSight() public method

Indicates whether there is nothing in the way from one point to another Monsters can be ignored, so it can be used to calculate where to spawn monsters
public IsThereLineOfSight ( Point from, Point to, bool ignoreMonsters ) : bool
from Point /// The start point ///
to Point /// The end point ///
ignoreMonsters bool /// If true, monsters will be ignored so they do not break line of sight ///
return bool

IsValidStartSquare() public method

Indicates whether a point is a valid start/spawn point
public IsValidStartSquare ( Point point ) : bool
point Point /// The point to check ///
return bool

MoveFigure() public method

Moves a figure to a specific point.
public MoveFigure ( Figure figure, Point point ) : void
figure Descent.Model.Player.Figure.Figure /// The figure that is moved ///
point Point /// The upper left corner of the figure, that is moved to ///
return void

OpenDoor() public method

Open a door
public OpenDoor ( Point point ) : void
point Point /// A point adjacent to a door ///
return void

PlaceFigure() public method

Places a figure at a specific point
public PlaceFigure ( Figure figure, Point point ) : void
figure Descent.Model.Player.Figure.Figure /// The figure that is placed ///
point Point /// The upper left corner of the figure ///
return void

RespawnDeadHeroes() public method

Respawns a dead hero next to the start glyph
public RespawnDeadHeroes ( ) : void
return void

SquareVisibleByPlayers() public method

Should the square be shown on the board? A square is visible by players if it has something on it, and if that squares area has been revealed
public SquareVisibleByPlayers ( int x, int y ) : bool
x int /// The x coordinate ///
y int /// The y coordinate ///
return bool

this() public method

Access a point on the board
public this ( Point p ) : Square
p Point /// The point to be accessed ///
return Square

this() public method

Access the (x, y)'th in the board
public this ( int x, int y ) : Square
x int /// The x coordinate ///
y int /// The y coordinate ///
return Square