Package com.prineside.tdi2.pathfinding
Class Path
java.lang.Object
com.prineside.tdi2.pathfinding.Path
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Path
static final SideFunction[][]
static final SideFunction[][]
For PathRendering - no rounding Index: [moveSide][sideShift] -
Constructor Summary
ConstructorDescriptionPath
(DefaultGraphPath<HeavyPathNode> fromPath) Creates new path from graph noes.Path
(Array<HeavyPathNode> fromPath) Creates new path from graph noes.Path
(HeavyPathNode[] fromPath) Creates new path from graph noes.Path
(HeavyPathNode[] fromPath, byte[] moveSides) -
Method Summary
Modifier and TypeMethodDescriptioncopyWithCustomMoveSides
(int[] sides) copyWithStartingMoveSide
(byte side) void
describe()
boolean
getByIdx
(int index) getByPassedTiles
(float passedTiles) int
getCount()
int
byte
getMoveSideByIdx
(int nodeIdx) Can only be used after prepare()byte
getMoveSideByPassedTiles
(float passedTiles) byte[]
Do not modifyint
getNodeIdxByPassedTiles
(float passedTiles) PathNode[]
getNodes()
Do not modify, only read.float
getPassedTilesDelta
(float deltaTime, float passedTiles, int sideShiftIndex, float speed) getPosition
(float passedTiles, int sideShiftIdx, Vector2 out) float
getPositionSimpleSegmentsForGraphics
(int sideShift, Array<PathSegmentForRendering> out) float
getRotation
(float passedTiles, int sideShiftIdx) float
getSpeedMultiplier
(float passedTiles, int sideShiftIdx) float
getSpeedMultiplierByNodeIdx
(int nodeIdx, int sideShiftIdx) int
hashCode()
boolean
isPassedTilesOnPath
(float passedTiles) Does not check for values below 0boolean
passesThroughTileType
(Map map, TileType tileType)
-
Field Details
-
EMPTY
-
SIDE_FUNCTIONS
-
SIDE_SIMPLE_FUNCTIONS
For PathRendering - no rounding Index: [moveSide][sideShift]
-
-
Constructor Details
-
Path
Creates new path from graph noes. Move sides will be calculated automatically. -
Path
Creates new path from graph noes. Move sides will be calculated automatically. -
Path
Creates new path from graph noes. Move sides will be calculated automatically. -
Path
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getNodes
Do not modify, only read. Use path methods to modify it. -
getCount
public int getCount() -
getMoveSideByIdx
public byte getMoveSideByIdx(int nodeIdx) Can only be used after prepare()- Returns:
- move side at tile index
-
getMoveSides
public byte[] getMoveSides()Do not modify -
getMoveSideByPassedTiles
public byte getMoveSideByPassedTiles(float passedTiles) -
copyWithStartingMoveSide
-
copyWithCustomMoveSides
- Parameters:
sides
- pairs of nodeIdx -> side, for example [0 (idx), 5 (side), 1 (idx), 3 (side)...]- Returns:
- a copy of a path with custom move sides
-
getLengthInTiles
public int getLengthInTiles() -
getPosition
- Parameters:
out
- vector to write position topassedTiles
- number of passed tiles since the beginning of the path. Values like 0.5 / 1.5 ... are at the edges of the tiles- Returns:
- param out, for chaining
-
passesThroughTileType
-
getPositionSimpleSegmentsForGraphics
public float getPositionSimpleSegmentsForGraphics(int sideShift, Array<PathSegmentForRendering> out) - Returns:
- длину всех сегментов
-
getSpeedMultiplier
public float getSpeedMultiplier(float passedTiles, int sideShiftIdx) -
getSpeedMultiplierByNodeIdx
public float getSpeedMultiplierByNodeIdx(int nodeIdx, int sideShiftIdx) -
getRotation
public float getRotation(float passedTiles, int sideShiftIdx) -
getByIdx
-
getByPassedTiles
-
getNodeIdxByPassedTiles
public int getNodeIdxByPassedTiles(float passedTiles) -
isPassedTilesOnPath
public boolean isPassedTilesOnPath(float passedTiles) Does not check for values below 0 -
describe
-
debugDump
public void debugDump() -
getPassedTilesDelta
public float getPassedTilesDelta(float deltaTime, float passedTiles, int sideShiftIndex, float speed)
-