C# Class AStarCollisionMap.Collision.CollisionMap

Show file Open project: Wotuu/RTS_XNA_v2 Class Usage Examples

Public Properties

Property Type Description
collisionMapTextureScale int

Private Properties

Property Type Description
Init void

Public Methods

Method Description
ClosestNodeInLOS ( Point p ) : AStarCollisionMap.Pathfinding.PathfindingNode

Gets the closest node in line of sight from the given point.

CollisionAt ( Point p ) : System.Boolean

Checks whether there is collision at a point.

CollisionAt ( int i ) : System.Boolean

Checks whether there is collision at an index.

CollisionMap ( Microsoft.Xna.Framework.Game game, int width, int height, String collisionMapPath, String collisionMapName, System.Boolean drawMode, int quadDepth ) : System
CollisionMap ( GraphicsDevice graphicsDevice, int width, int height, System.Boolean drawMode, int quadDepth ) : System
Dispose ( ) : void

Disposes of this collisionmap, releasing most resources used by the map.

FireCollisionChangedEvent ( CollisionChangedEvent e ) : void

Fires a collision changed event to all listeners.

GetNodeLocationsAroundEdges ( ) : CustomArrayList

Places nodes around all the edges

IndexExists ( Point p ) : System.Boolean
IndexExists ( int index ) : System.Boolean
IndexToPoint ( int index ) : Point

Converts an index to a point.

IsCollisionBetween ( Point p1, Point p2 ) : System.Boolean

Checks whether there is collision between two points.

LoadMap ( String path, String mapname ) : void

Loads a collision map from a file.

PixelsBetweenPoints ( Point p1, Point p2, int spacing ) : Point[]

Gets the pixels between points.

PointToIndex ( Point p ) : int
PointToIndex ( int x, int y ) : int

Returns the index of a certain point.

SaveToPng ( ) : void

Saves this collisionmap to a file.

UpdateCollisionMap ( Rectangle rect, System.Boolean add ) : void

Updates the collisionmap, without updating or adding pathfinding points. DO NOT USE THIS METHOD IN-GAME, ONLY IN THE EDITOR.

Private Methods

Method Description
Init ( int width, int height, String collisionMapPath, String collisionMapName, System.Boolean drawMode, int quadDepth ) : void

Method Details

ClosestNodeInLOS() public method

Gets the closest node in line of sight from the given point.
public ClosestNodeInLOS ( Point p ) : AStarCollisionMap.Pathfinding.PathfindingNode
p Point The point.
return AStarCollisionMap.Pathfinding.PathfindingNode

CollisionAt() public method

Checks whether there is collision at a point.
public CollisionAt ( Point p ) : System.Boolean
p Point The point to check.
return System.Boolean

CollisionAt() public method

Checks whether there is collision at an index.
public CollisionAt ( int i ) : System.Boolean
i int The index
return System.Boolean

CollisionMap() public method

public CollisionMap ( Microsoft.Xna.Framework.Game game, int width, int height, String collisionMapPath, String collisionMapName, System.Boolean drawMode, int quadDepth ) : System
game Microsoft.Xna.Framework.Game
width int
height int
collisionMapPath String
collisionMapName String
drawMode System.Boolean
quadDepth int
return System

CollisionMap() public method

public CollisionMap ( GraphicsDevice graphicsDevice, int width, int height, System.Boolean drawMode, int quadDepth ) : System
graphicsDevice GraphicsDevice
width int
height int
drawMode System.Boolean
quadDepth int
return System

Dispose() public method

Disposes of this collisionmap, releasing most resources used by the map.
public Dispose ( ) : void
return void

FireCollisionChangedEvent() public method

Fires a collision changed event to all listeners.
public FireCollisionChangedEvent ( CollisionChangedEvent e ) : void
e CollisionChangedEvent The event
return void

GetNodeLocationsAroundEdges() public method

Places nodes around all the edges
public GetNodeLocationsAroundEdges ( ) : CustomArrayList
return CustomArrayList

IndexExists() public method

public IndexExists ( Point p ) : System.Boolean
p Point
return System.Boolean

IndexExists() public method

public IndexExists ( int index ) : System.Boolean
index int
return System.Boolean

IndexToPoint() public method

Converts an index to a point.
public IndexToPoint ( int index ) : Point
index int The index.
return Point

IsCollisionBetween() public method

Checks whether there is collision between two points.
public IsCollisionBetween ( Point p1, Point p2 ) : System.Boolean
p1 Point The first point.
p2 Point The second point.
return System.Boolean

LoadMap() public method

Loads a collision map from a file.
public LoadMap ( String path, String mapname ) : void
path String The path of the map, WITHOUT a trailing slash.
mapname String The mapname.
return void

PixelsBetweenPoints() public method

Gets the pixels between points.
public PixelsBetweenPoints ( Point p1, Point p2, int spacing ) : Point[]
p1 Point Point one
p2 Point Point two
spacing int The pixel spacing between the points (default should be 1). Lower than 1 will use 1.
return Point[]

PointToIndex() public method

public PointToIndex ( Point p ) : int
p Point The point.
return int

PointToIndex() public method

Returns the index of a certain point.
public PointToIndex ( int x, int y ) : int
x int
y int
return int

SaveToPng() public method

Saves this collisionmap to a file.
public SaveToPng ( ) : void
return void

UpdateCollisionMap() public method

Updates the collisionmap, without updating or adding pathfinding points. DO NOT USE THIS METHOD IN-GAME, ONLY IN THE EDITOR.
public UpdateCollisionMap ( Rectangle rect, System.Boolean add ) : void
rect Microsoft.Xna.Framework.Rectangle The rectangle
add System.Boolean Whether to add or to remove the rect.
return void

Property Details

collisionMapTextureScale public property

public int collisionMapTextureScale
return int