Package org.boxutil.base.api.resource
Interface StaticTrailTracker
- All Known Implementing Classes:
BaseProjectileTrailTracker
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
For example, in combat:
final CombatEntityAPI target;
StaticTrailTracker tracker = (amount, elapsedTime, callback) -> {
if (target.wasRemoved() || target.isExpired()) callback.destroy(); // condition is for reference only
final Vector2f loc = target.getLocation();
// // For this tracker have complex or high-overhead logical on execution.
// if (callback.isNotRecommendedRecordsCurrent(loc)) {
// callback.pauseOnce();
// return;
// }
callback.setCurrentLocation(target);
callback.setCurrentFacing(target.getVelocity().normalise(new Vector2f()));
};
Or in campaign:
final SectorEntityToken target;
final LocationAPI playerLocation;
StaticTrailTracker tracker = (amount, elapsedTime, callback) -> {
if (playerLocation != target.getContainingLocation() || target.isExpired()) callback.destroy(); // condition is for reference only
final Vector2f loc = target.getLocation();
// // For this tracker have complex or high-overhead logical on execution.
// if (callback.isNotRecommendedRecordsCurrent(loc)) {
// callback.pauseOnce();
// return;
// }
callback.setCurrentLocation(target);
callback.setCurrentFacing(target.getVelocity().normalise(new Vector2f()));
};
And then, prepare a unique StaticTrailData instance and chose a rendering layer,
call CombatRenderingManager.addStaticTrail(StaticTrailData, CombatEntityAPI, CombatEngineLayers, StaticTrailTracker) in combat, add to campaign is similar.
For what the tracker the autogen static trail system using: BaseProjectileTrailTracker
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatWill prevents node spawn when total current-previous location distance square is less than it. -
Method Summary
Modifier and TypeMethodDescriptionvoidadvance(float amount, float elapsedTime, StaticTrailTracker.Result callback) Will not record any nodes when game paused.
-
Field Details
-
MINIMAL_VALID_LENGTH_SQ
static final float MINIMAL_VALID_LENGTH_SQWill prevents node spawn when total current-previous location distance square is less than it.- See Also:
-
-
Method Details
-
advance
Will not record any nodes when game paused.- Parameters:
amount- frame time since last advance call, exclude paused.elapsedTime- exclude paused.callback- use it for adjust the current trail node.
-