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 class
static class
static class
static enum
static enum
static class
static class
static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static 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 int
static final Path.SideFunction[][]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an item at the end of this path.calculateMoveSides
(int index) Просчитывает стороны движенияstatic Path.MoveSide
calculateMoveSides
(PathNode curr, PathNode prev, PathNode next) Как двигаться по curr от prev до nextvoid
clear()
Clears this path.void
describe()
get
(float passedTiles) get
(int index) Returns the item of this path at the given index.int
getCount()
Returns the number of items of this path.int
getMoveSide
(float passedTiles) getMoveSide
(int nodeIdx) Может быть вызван только после prepare()int
com.badlogic.gdx.math.Vector2
getPosition
(float passedTiles, int sideShiftIdx) float
getPositionSimpleSegmentsForGraphics
(int sideShift, com.badlogic.gdx.utils.Array<Path.PathSegment> out) float
getRotation
(float passedTiles, int sideShiftIdx) float
getSpeedMultiplier
(float passedTiles, int sideShiftIdx) boolean
iterator()
boolean
passesThroughTileType
(TileType tileType) void
Просчитать стороны движения и подготовить путь к использованиюvoid
read
(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) void
reset()
Вызывается когда путь назначен новому юниту и должен быть полностью пересобранvoid
reverse()
Reverses this path.void
void
setMoveSide
(int nodeIdx, Path.MoveSide side) Изменить сторону пути.void
write
(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, wait
Methods 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:
write
in interfacecom.esotericsoftware.kryo.KryoSerializable
-
read
public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) - Specified by:
read
in interfacecom.esotericsoftware.kryo.KryoSerializable
-
getNodeCount
public int getNodeCount() -
set
-
clear
public void clear()Description copied from interface:com.badlogic.gdx.ai.pfa.GraphPath
Clears this path.- Specified by:
clear
in interfacecom.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 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.GraphPath
Adds an item at the end of this path.- Specified by:
add
in interfacecom.badlogic.gdx.ai.pfa.GraphPath<PathNode>
-
get
Description copied from interface:com.badlogic.gdx.ai.pfa.GraphPath
Returns the item of this path at the given index.- Specified by:
get
in interfacecom.badlogic.gdx.ai.pfa.GraphPath<PathNode>
-
get
-
reverse
public void reverse()Description copied from interface:com.badlogic.gdx.ai.pfa.GraphPath
Reverses this path.- Specified by:
reverse
in interfacecom.badlogic.gdx.ai.pfa.GraphPath<PathNode>
-
describe
-
debugDump
public void debugDump() -
iterator
-