Package com.prineside.tdi2.pathfinding
Class Path
java.lang.Object
com.prineside.tdi2.pathfinding.Path
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Pathstatic final SideFunction[][]static final SideFunction[][]For PathRendering - no rounding Index: [moveSide][sideShift] -
Constructor Summary
ConstructorsConstructorDescriptionPath(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) voiddescribe()booleangetByIdx(int index) getByPassedTiles(float passedTiles) intgetCount()intbytegetMoveSideByIdx(int nodeIdx) Can only be used after prepare()bytegetMoveSideByPassedTiles(float passedTiles) byte[]Do not modifyintgetNodeIdxByPassedTiles(float passedTiles) PathNode[]getNodes()Do not modify, only read.floatgetPassedTilesDelta(float deltaTime, float passedTiles, int sideShiftIndex, float speed) getPosition(float passedTiles, int sideShiftIdx, Vector2 out) floatgetPositionSimpleSegmentsForGraphics(int sideShift, Array<PathSegmentForRendering> out) floatgetRotation(float passedTiles, int sideShiftIdx) floatgetSpeedMultiplier(float passedTiles, int sideShiftIdx) floatgetSpeedMultiplierByNodeIdx(int nodeIdx, int sideShiftIdx) inthashCode()booleanisPassedTilesOnPath(float passedTiles) Does not check for values below 0booleanpassesThroughTileType(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)
-