Package com.prineside.tdi2
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>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic enumstatic enumstatic classstatic classstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final Path.MoveSide[][]com.badlogic.gdx.utils.Array<Path.MoveSide>com.badlogic.gdx.utils.Array<PathNode>static final Path.SideFunction[][]static final int[][]static final intstatic final Path.SideFunction[][] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an item at the end of this path.calculateMoveSides(int index) Просчитывает стороны движенияstatic Path.MoveSidecalculateMoveSides(PathNode curr, PathNode prev, PathNode next) Как двигаться по curr от prev до nextvoidclear()Clears this path.voiddescribe()get(float passedTiles) get(int index) Returns the item of this path at the given index.intgetCount()Returns the number of items of this path.intgetMoveSide(float passedTiles) getMoveSide(int nodeIdx) Может быть вызван только после prepare()intcom.badlogic.gdx.math.Vector2getPosition(float passedTiles, int sideShiftIdx) floatgetPositionSimpleSegmentsForGraphics(int sideShift, com.badlogic.gdx.utils.Array<Path.PathSegment> out) floatgetRotation(float passedTiles, int sideShiftIdx) floatgetSpeedMultiplier(float passedTiles, int sideShiftIdx) booleaniterator()booleanpassesThroughTileType(TileType tileType) voidПросчитать стороны движения и подготовить путь к использованиюvoidread(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) voidreset()Вызывается когда путь назначен новому юниту и должен быть полностью пересобранvoidreverse()Reverses this path.voidvoidsetMoveSide(int nodeIdx, Path.MoveSide side) Изменить сторону пути.voidwrite(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
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
-
SIDE_FUNCTIONS
-
SIDE_SIMPLE_FUNCTIONS
-
nodes
-
moveSides
-
-
Constructor Details
-
Path
public Path() -
Path
-
-
Method Details
-
write
public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) - Specified by:
writein interfacecom.esotericsoftware.kryo.KryoSerializable
-
read
public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) - Specified by:
readin interfacecom.esotericsoftware.kryo.KryoSerializable
-
getNodeCount
public int getNodeCount() -
set
-
clear
public void clear()Description copied from interface:com.badlogic.gdx.ai.pfa.GraphPathClears this path.- Specified by:
clearin interfacecom.badlogic.gdx.ai.pfa.GraphPath<PathNode>
-
getCount
public int getCount()Description copied from interface:com.badlogic.gdx.ai.pfa.GraphPathReturns the number of items of this path.- Specified by:
getCountin interfacecom.badlogic.gdx.ai.pfa.GraphPath<PathNode>
-
getMoveSide
Может быть вызван только после prepare()- Returns:
- стороны тайла с указанным индексом
-
getMoveSide
-
setMoveSide
Изменить сторону пути. Если будет вызван любой метод, изменяющий путь, результат работы этого метода будет сброшен. -
getLengthInTiles
public int getLengthInTiles() -
calculateMoveSides
Как двигаться по curr от prev до next -
calculateMoveSides
Просчитывает стороны движения -
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
-
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
Description copied from interface:com.badlogic.gdx.ai.pfa.GraphPathAdds an item at the end of this path.- Specified by:
addin interfacecom.badlogic.gdx.ai.pfa.GraphPath<PathNode>
-
get
Description copied from interface:com.badlogic.gdx.ai.pfa.GraphPathReturns the item of this path at the given index.- Specified by:
getin interfacecom.badlogic.gdx.ai.pfa.GraphPath<PathNode>
-
get
-
reverse
public void reverse()Description copied from interface:com.badlogic.gdx.ai.pfa.GraphPathReverses this path.- Specified by:
reversein interfacecom.badlogic.gdx.ai.pfa.GraphPath<PathNode>
-
describe
-
debugDump
public void debugDump() -
iterator
-