C# Class SharpNav.TiledNavMesh

A TiledNavMesh is a continuous region, which is used for pathfinding.
Exibir arquivo Open project: Robmaister/SharpNav Class Usage Examples

Public Methods

Method Description
AddTile ( SharpNav.NavMeshBuilder data ) : NavPolyId

Build a tile and link all the polygons togther, both internally and externally. Make sure to link off-mesh connections as well.

AddTileAt ( NavTile tile, NavPolyId id ) : void
CalcTileLoc ( Microsoft.Xna.Framework.Vector3 &pos, int &tx, int &ty ) : void

Calculates the tile location.

GetNeighborTilesAt ( Vector2i location, BoundarySide side ) : IEnumerable
GetNeighborTilesAt ( int x, int y, BoundarySide side ) : IEnumerable

Gets the neighboring tile at that position

GetNextTileRef ( ) : NavPolyId
GetOffMeshConnectionPolyEndPoints ( NavPolyId prevRef, NavPolyId polyRef, Microsoft.Xna.Framework.Vector3 &startPos, Microsoft.Xna.Framework.Vector3 &endPos ) : bool

Retrieve the endpoints of the offmesh connection at the specified polygon

GetTileAt ( Vector2i location, int layer ) : NavTile

Find the tile at a specific location.

GetTileAt ( int x, int y, int layer ) : NavTile

Find the tile at a specific location.

GetTileRef ( NavTile tile ) : NavPolyId

Get the tile reference

GetTilesAt ( Vector2i location ) : IEnumerable
GetTilesAt ( int x, int y ) : IEnumerable

Find and add a tile if it is found

IsValidPolyRef ( NavPolyId reference ) : bool

Check if polygon reference is valid.

TiledNavMesh ( Microsoft.Xna.Framework.Vector3 origin, float tileWidth, float tileHeight, int maxTiles, int maxPolys )
TiledNavMesh ( SharpNav.NavMeshBuilder data )

Initializes a new instance of the TiledNavMesh class.

TryGetTileAndPolyByRef ( NavPolyId reference, NavTile &tile, NavPoly &poly ) : bool

Retrieve the tile and poly based off of a polygon reference

TryGetTileAndPolyByRefUnsafe ( NavPolyId reference, NavTile &tile, NavPoly &poly ) : void

Only use this function if it is known that the provided polygon reference is valid.

this ( NavPolyId id ) : NavTile
this ( int reference ) : NavTile
this ( Vector2i location ) : ReadOnlyCollection

Gets the mesh tile at a specified index.

this ( int x, int y ) : ReadOnlyCollection

Method Details

AddTile() public method

Build a tile and link all the polygons togther, both internally and externally. Make sure to link off-mesh connections as well.
public AddTile ( SharpNav.NavMeshBuilder data ) : NavPolyId
data SharpNav.NavMeshBuilder Navigation Mesh data
return NavPolyId

AddTileAt() public method

public AddTileAt ( NavTile tile, NavPolyId id ) : void
tile NavTile
id NavPolyId
return void

CalcTileLoc() public method

Calculates the tile location.
public CalcTileLoc ( Microsoft.Xna.Framework.Vector3 &pos, int &tx, int &ty ) : void
pos Microsoft.Xna.Framework.Vector3 The position
tx int The tile's x-coordinate
ty int The tile's y-coordinate
return void

GetNeighborTilesAt() public method

public GetNeighborTilesAt ( Vector2i location, BoundarySide side ) : IEnumerable
location Vector2i
side BoundarySide
return IEnumerable

GetNeighborTilesAt() public method

Gets the neighboring tile at that position
public GetNeighborTilesAt ( int x, int y, BoundarySide side ) : IEnumerable
x int The x-coordinate
y int The y-coordinate
side BoundarySide The side value
return IEnumerable

GetNextTileRef() public method

public GetNextTileRef ( ) : NavPolyId
return NavPolyId

GetOffMeshConnectionPolyEndPoints() public method

Retrieve the endpoints of the offmesh connection at the specified polygon
public GetOffMeshConnectionPolyEndPoints ( NavPolyId prevRef, NavPolyId polyRef, Microsoft.Xna.Framework.Vector3 &startPos, Microsoft.Xna.Framework.Vector3 &endPos ) : bool
prevRef NavPolyId The previous polygon reference
polyRef NavPolyId The current polygon reference
startPos Microsoft.Xna.Framework.Vector3 The starting position
endPos Microsoft.Xna.Framework.Vector3 The ending position
return bool

GetTileAt() public method

Find the tile at a specific location.
public GetTileAt ( Vector2i location, int layer ) : NavTile
location Vector2i The (X, Y) coordinate of the tile.
layer int The layer of the tile.
return NavTile

GetTileAt() public method

Find the tile at a specific location.
public GetTileAt ( int x, int y, int layer ) : NavTile
x int The X coordinate of the tile.
y int The Y coordinate of the tile.
layer int The layer of the tile.
return NavTile

GetTileRef() public method

Get the tile reference
public GetTileRef ( NavTile tile ) : NavPolyId
tile NavTile Tile to look for
return NavPolyId

GetTilesAt() public method

public GetTilesAt ( Vector2i location ) : IEnumerable
location Vector2i
return IEnumerable

GetTilesAt() public method

Find and add a tile if it is found
public GetTilesAt ( int x, int y ) : IEnumerable
x int The x-coordinate
y int The y-coordinate
return IEnumerable

IsValidPolyRef() public method

Check if polygon reference is valid.
public IsValidPolyRef ( NavPolyId reference ) : bool
reference NavPolyId Polygon reference
return bool

TiledNavMesh() public method

public TiledNavMesh ( Microsoft.Xna.Framework.Vector3 origin, float tileWidth, float tileHeight, int maxTiles, int maxPolys )
origin Microsoft.Xna.Framework.Vector3
tileWidth float
tileHeight float
maxTiles int
maxPolys int

TiledNavMesh() public method

Initializes a new instance of the TiledNavMesh class.
public TiledNavMesh ( SharpNav.NavMeshBuilder data )
data SharpNav.NavMeshBuilder The Navigation Mesh data

TryGetTileAndPolyByRef() public method

Retrieve the tile and poly based off of a polygon reference
public TryGetTileAndPolyByRef ( NavPolyId reference, NavTile &tile, NavPoly &poly ) : bool
reference NavPolyId Polygon reference
tile NavTile Resulting tile
poly SharpNav.Pathfinding.NavPoly Resulting poly
return bool

TryGetTileAndPolyByRefUnsafe() public method

Only use this function if it is known that the provided polygon reference is valid.
public TryGetTileAndPolyByRefUnsafe ( NavPolyId reference, NavTile &tile, NavPoly &poly ) : void
reference NavPolyId Polygon reference
tile NavTile Resulting tile
poly SharpNav.Pathfinding.NavPoly Resulting poly
return void

this() public method

public this ( NavPolyId id ) : NavTile
id NavPolyId
return NavTile

this() public method

public this ( int reference ) : NavTile
reference int
return NavTile

this() public method

Gets the mesh tile at a specified index.
public this ( Vector2i location ) : ReadOnlyCollection
location Vector2i
return ReadOnlyCollection

this() public method

public this ( int x, int y ) : ReadOnlyCollection
x int
y int
return ReadOnlyCollection