Class Path

java.lang.Object
com.prineside.tdi2.Path
All Implemented Interfaces:
com.badlogic.gdx.ai.pfa.GraphPath<PathNode>, com.esotericsoftware.kryo.KryoSerializable, Iterable<PathNode>

public final class Path extends Object implements com.badlogic.gdx.ai.pfa.GraphPath<PathNode>, com.esotericsoftware.kryo.KryoSerializable
  • Field Details

    • SIDE_SHIFTS

      public static final int SIDE_SHIFTS
      See Also:
    • MIDDLE_SIDE_SHIFT

      public static final int MIDDLE_SIDE_SHIFT
      See Also:
    • SIDE_SHIFT_BY_COUNT

      public static final int[][] SIDE_SHIFT_BY_COUNT
    • MOVE_SIDE_BY_DIRECTIONS

      public static final Path.MoveSide[][] MOVE_SIDE_BY_DIRECTIONS
    • SIDE_FUNCTIONS

      public static final Path.SideFunction[][] SIDE_FUNCTIONS
    • SIDE_SIMPLE_FUNCTIONS

      public static final Path.SideFunction[][] SIDE_SIMPLE_FUNCTIONS
    • nodes

      public com.badlogic.gdx.utils.Array<PathNode> nodes
    • moveSides

      public com.badlogic.gdx.utils.Array<Path.MoveSide> moveSides
  • Constructor Details

    • Path

      public Path()
    • Path

      public Path(Path fromPath)
  • Method Details

    • write

      public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output)
      Specified by:
      write in interface com.esotericsoftware.kryo.KryoSerializable
    • read

      public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input)
      Specified by:
      read in interface com.esotericsoftware.kryo.KryoSerializable
    • getNodeCount

      public int getNodeCount()
    • set

      public void set(Path fromPath)
    • clear

      public void clear()
      Description copied from interface: com.badlogic.gdx.ai.pfa.GraphPath
      Clears this path.
      Specified by:
      clear in interface com.badlogic.gdx.ai.pfa.GraphPath<PathNode>
    • getCount

      public int getCount()
      Description copied from interface: com.badlogic.gdx.ai.pfa.GraphPath
      Returns the number of items of this path.
      Specified by:
      getCount in interface com.badlogic.gdx.ai.pfa.GraphPath<PathNode>
    • getMoveSide

      public Path.MoveSide getMoveSide(int nodeIdx)
      Может быть вызван только после prepare()
      Returns:
      стороны тайла с указанным индексом
    • getMoveSide

      public Path.MoveSide getMoveSide(float passedTiles)
    • setMoveSide

      public void setMoveSide(int nodeIdx, Path.MoveSide side)
      Изменить сторону пути. Если будет вызван любой метод, изменяющий путь, результат работы этого метода будет сброшен.
    • getLengthInTiles

      public int getLengthInTiles()
    • calculateMoveSides

      public static Path.MoveSide calculateMoveSides(PathNode curr, PathNode prev, PathNode next)
      Как двигаться по curr от prev до next
    • calculateMoveSides

      public Path.MoveSide calculateMoveSides(int index)
      Просчитывает стороны движения
    • isPrepared

      public boolean isPrepared()
    • prepareIfNeeded

      public void prepareIfNeeded()
      Просчитать стороны движения и подготовить путь к использованию
    • reset

      public void reset()
      Вызывается когда путь назначен новому юниту и должен быть полностью пересобран
    • getPosition

      public com.badlogic.gdx.math.Vector2 getPosition(float passedTiles, int sideShiftIdx)
      Parameters:
      passedTiles - количество пройденных тайлов от начала пути. При 0.5 / 1.5 ...находится на границе тайлов
    • passesThroughTileType

      public boolean passesThroughTileType(TileType tileType)
    • getPositionSimpleSegmentsForGraphics

      public float getPositionSimpleSegmentsForGraphics(int sideShift, com.badlogic.gdx.utils.Array<Path.PathSegment> out)
      Returns:
      длину всех сегментов
    • getSpeedMultiplier

      public float getSpeedMultiplier(float passedTiles, int sideShiftIdx)
    • getRotation

      public float getRotation(float passedTiles, int sideShiftIdx)
    • add

      public void add(PathNode node)
      Description copied from interface: com.badlogic.gdx.ai.pfa.GraphPath
      Adds an item at the end of this path.
      Specified by:
      add in interface com.badlogic.gdx.ai.pfa.GraphPath<PathNode>
    • get

      public PathNode get(int index)
      Description copied from interface: com.badlogic.gdx.ai.pfa.GraphPath
      Returns the item of this path at the given index.
      Specified by:
      get in interface com.badlogic.gdx.ai.pfa.GraphPath<PathNode>
    • get

      public PathNode get(float passedTiles)
    • reverse

      public void reverse()
      Description copied from interface: com.badlogic.gdx.ai.pfa.GraphPath
      Reverses this path.
      Specified by:
      reverse in interface com.badlogic.gdx.ai.pfa.GraphPath<PathNode>
    • describe

      public String describe()
    • debugDump

      public void debugDump()
    • iterator

      public Iterator<PathNode> iterator()
      Specified by:
      iterator in interface Iterable<PathNode>