Package dev.twilite.game.stream
Class UnitView<T extends Unit,V extends UnitView<T,V>>
java.lang.Object
dev.twilite.game.stream.View<T>
dev.twilite.game.stream.UnitView<T,V>
- All Implemented Interfaces:
Iterable<T>
- Direct Known Subclasses:
ActorView,EffectView,HintArrowView,ProjectileView,SceneObjectView,TileItemView
View specialization for positioned game units.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a new view with an additional unit filter.Returns the nearest unit to the coordinate.Returns the nearest unit to another unit.not()Returns a new view with the most recent filter negated.Filters to units whose occupied area contains any of the coordinates.Returns a new unit view with the supplied filter OR'ed with the most recent filter.Filters to units reachable from the local player using loaded local-world collision.reachableWithin(int maxDistance) Filters to units reachable from the local player within the supplied local movement steps.within(int distance) Filters to units within Chebyshev distance of the local player.Filters to units within Chebyshev distance of a coordinate.Filters to units whose occupied area intersects any of the areas.Filters to units within Chebyshev distance of an area.Filters to units within Chebyshev distance of another unit's occupied area.Methods inherited from class dev.twilite.game.stream.View
count, exists, first, iterator, map, mapToInt, stream, toListMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
UnitView
Creates a unit view backed by a stream supplier.
-
-
Method Details
-
filter
Returns a new view with an additional unit filter. -
not
Returns a new view with the most recent filter negated. -
or
Returns a new unit view with the supplied filter OR'ed with the most recent filter. -
on
Filters to units whose occupied area contains any of the coordinates. -
within
Filters to units whose occupied area intersects any of the areas. -
within
Filters to units within Chebyshev distance of a coordinate.- Parameters:
coord- coordinate to measure fromdistance- maximum accepted distance
-
within
Filters to units within Chebyshev distance of an area.- Parameters:
rect- area to measure fromdistance- maximum accepted distance
-
within
Filters to units within Chebyshev distance of another unit's occupied area.- Parameters:
unit- unit to measure fromdistance- maximum accepted distance
-
within
Filters to units within Chebyshev distance of the local player. -
reachable
Filters to units reachable from the local player using loaded local-world collision. -
reachableWithin
Filters to units reachable from the local player within the supplied local movement steps.- Parameters:
maxDistance- maximum local movement steps to search
-
nearestTo
Returns the nearest unit to the coordinate. -
nearestTo
Returns the nearest unit to another unit.
-