AbstractRouteSignpost.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using UnityEngine;
  2. namespace ARLocation.MapboxRoutes
  3. {
  4. public class SignPostEventArgs
  5. {
  6. public MapboxRoute Route;
  7. public Vector3 TargetPos;
  8. public Vector3? NextTargetPos;
  9. public Vector3? PrevTargetPos;
  10. public Vector3 UserPos;
  11. public float Distance;
  12. public bool IsCurrentTarget;
  13. public int StepIndex;
  14. public string Instruction { get; internal set; }
  15. public string Name { get; internal set; }
  16. }
  17. /// <summary>
  18. /// This abstract class should implement all the behaviour to guide the user along the route.
  19. ///
  20. /// Each "Step" of the route will instantiate an instance of
  21. /// `AbstractRouteSignpost` associated with a step/target of the route.
  22. ///
  23. /// For a reference implementation see the `SignPost` class.
  24. ///
  25. /// </summary>
  26. public abstract class AbstractRouteSignpost : MonoBehaviour
  27. {
  28. /// <summary>
  29. /// Initialization method. Called when the route is built the `AbstractRouteSignpost` is instantiated.
  30. /// </summary>
  31. public abstract void Init(MapboxRoute route);
  32. /// <summary>
  33. /// Called by `MapboxRoute` in the middle of its `Update` method. If this function returns `false` when the sign post's target
  34. /// is the current one, then `MapboxRoute` will set the current target to the next target.
  35. /// </summary>
  36. public abstract bool UpdateSignPost(SignPostEventArgs args);
  37. /// <summary>
  38. /// Called when the the sign post's target becomes the current target.
  39. /// </summary>
  40. public abstract void OnCurrentTarget(SignPostEventArgs args);
  41. /// <summary>
  42. /// Called when the the sign post's target no longer is the current target.
  43. /// </summary>
  44. public abstract void OffCurrentTarget(SignPostEventArgs args);
  45. }
  46. }