Class Path

java.lang.Object
com.prineside.tdi2.pathfinding.Path

public final class Path extends Object
  • Field Details

    • EMPTY

      public static final Path EMPTY
    • SIDE_FUNCTIONS

      public static final SideFunction[][] SIDE_FUNCTIONS
    • SIDE_SIMPLE_FUNCTIONS

      public static final SideFunction[][] SIDE_SIMPLE_FUNCTIONS
      For PathRendering - no rounding Index: [moveSide][sideShift]
  • Constructor Details

    • Path

      public Path(DefaultGraphPath<HeavyPathNode> fromPath)
      Creates new path from graph noes. Move sides will be calculated automatically.
    • Path

      public Path(Array<HeavyPathNode> fromPath)
      Creates new path from graph noes. Move sides will be calculated automatically.
    • Path

      public Path(HeavyPathNode[] fromPath)
      Creates new path from graph noes. Move sides will be calculated automatically.
    • Path

      public Path(HeavyPathNode[] fromPath, byte[] moveSides)
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • getNodes

      public PathNode[] 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

      public Path copyWithStartingMoveSide(byte side)
    • copyWithCustomMoveSides

      public Path copyWithCustomMoveSides(int[] sides)
      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

      public Vector2 getPosition(float passedTiles, int sideShiftIdx, Vector2 out)
      Parameters:
      out - vector to write position to
      passedTiles - 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

      public boolean passesThroughTileType(Map map, TileType tileType)
    • 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

      public PathNode getByIdx(int index)
    • getByPassedTiles

      public PathNode getByPassedTiles(float passedTiles)
    • getNodeIdxByPassedTiles

      public int getNodeIdxByPassedTiles(float passedTiles)
    • isPassedTilesOnPath

      public boolean isPassedTilesOnPath(float passedTiles)
      Does not check for values below 0
    • describe

      public String describe()
    • debugDump

      public void debugDump()
    • getPassedTilesDelta

      public float getPassedTilesDelta(float deltaTime, float passedTiles, int sideShiftIndex, float speed)