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.

@FunctionalInterface public interface StaticTrailTracker
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
    Modifier and Type
    Interface
    Description
    static interface 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float
    Will prevents node spawn when total current-previous location distance square is less than it.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    advance(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_SQ
      Will prevents node spawn when total current-previous location distance square is less than it.
      See Also:
  • Method Details

    • advance

      void advance(float amount, float elapsedTime, StaticTrailTracker.Result callback)
      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.