Package dev.twilite.game.trait
Interface Unit
- All Known Subinterfaces:
InteractableUnit
- All Known Implementing Classes:
Actor,Effect,HintArrow,Npc,Player,Projectile,SceneObject,TileItem,WorldEntity
public interface Unit
Positioned object in a game world.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Rectarea()Returns the area this unit occupies.coord()Returns this unit's world coordinate.directPathTo(Coord coord) Returns the direct greedy/dumb walk path from this unit to a coordinate in the currently loaded world.directPathTo(Rect rect) Returns the direct greedy/dumb walk path from this unit to an area in the currently loaded world.directPathTo(Unit unit) Returns the direct greedy/dumb walk path from this unit to another unit in the currently loaded world.default intdistanceTo(Coord coord) Returns Chebyshev tile distance from this unit's occupied area to a coordinate.default intdistanceTo(Rect rect) Returns Chebyshev tile distance from this unit's occupied area to an area.default intdistanceTo(Unit unit) Returns Chebyshev tile distance between this unit and another unit.fine()Returns this unit's fine coordinate, representing its model location.default booleanlineOfSightTo(Coord coord) Returns whether line of sight is clear from this unit to a coordinate in the currently loaded world.default booleanlineOfSightTo(Rect rect) Returns whether line of sight is clear from this unit to an area in the currently loaded world.default booleanlineOfSightTo(Unit unit) Returns whether line of sight is clear from this unit to another unit in the currently loaded world.default booleanlineOfWalkTo(Coord coord) Returns whether a direct line of walk is clear from this unit to a coordinate in the currently loaded world.default booleanlineOfWalkTo(Rect rect) Returns whether a direct line of walk is clear from this unit to an area in the currently loaded world.default booleanlineOfWalkTo(Unit unit) Returns whether a direct line of walk is clear from this unit to another unit in the currently loaded world.default intmanhattanDistanceTo(Coord coord) Returns Manhattan/taxicab tile distance from this unit's occupied area to a coordinate.default intmanhattanDistanceTo(Rect rect) Returns Manhattan/taxicab tile distance from this unit's occupied area to an area.default intmanhattanDistanceTo(Unit unit) Returns Manhattan/taxicab tile distance between this unit and another unit.map()Returns this unit's map coordinate relative to the loaded world area.default booleanpathInDirection(int x, int y) Returns whether this unit has an open one-tile path in the supplied direction in the currently loaded world.world()Returns the world this unit belongs to.
-
Method Details
-
world
World world()Returns the world this unit belongs to. -
coord
Coord coord()Returns this unit's world coordinate. -
fine
Coord.Fine fine()Returns this unit's fine coordinate, representing its model location. -
map
Coord.Map map()Returns this unit's map coordinate relative to the loaded world area. -
area
Returns the area this unit occupies. -
distanceTo
Returns Chebyshev tile distance from this unit's occupied area to a coordinate. -
distanceTo
Returns Chebyshev tile distance between this unit and another unit. -
distanceTo
Returns Chebyshev tile distance from this unit's occupied area to an area. -
manhattanDistanceTo
Returns Manhattan/taxicab tile distance from this unit's occupied area to a coordinate. -
manhattanDistanceTo
Returns Manhattan/taxicab tile distance between this unit and another unit. -
manhattanDistanceTo
Returns Manhattan/taxicab tile distance from this unit's occupied area to an area. -
lineOfSightTo
Returns whether line of sight is clear from this unit to a coordinate in the currently loaded world. -
lineOfSightTo
Returns whether line of sight is clear from this unit to an area in the currently loaded world. -
lineOfSightTo
Returns whether line of sight is clear from this unit to another unit in the currently loaded world. -
lineOfWalkTo
Returns whether a direct line of walk is clear from this unit to a coordinate in the currently loaded world. -
lineOfWalkTo
Returns whether a direct line of walk is clear from this unit to an area in the currently loaded world. -
lineOfWalkTo
Returns whether a direct line of walk is clear from this unit to another unit in the currently loaded world. -
directPathTo
Returns the direct greedy/dumb walk path from this unit to a coordinate in the currently loaded world.This is not full pathfinding. It only steps directly toward the target and returns any partial path before blocking.
-
directPathTo
Returns the direct greedy/dumb walk path from this unit to an area in the currently loaded world.This is not full pathfinding. It only steps directly toward the target and returns any partial path before blocking.
-
directPathTo
Returns the direct greedy/dumb walk path from this unit to another unit in the currently loaded world.This is not full pathfinding. It only steps directly toward the target and returns any partial path before blocking.
-
pathInDirection
default boolean pathInDirection(int x, int y) Returns whether this unit has an open one-tile path in the supplied direction in the currently loaded world.
-