SignalSourceAsset.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using UnityEngine;
  2. namespace Cinemachine
  3. {
  4. /// <summary>Interface for raw signal provider</summary>
  5. public interface ISignalSource6D
  6. {
  7. /// <summary>
  8. /// Returns the length on seconds of the signal.
  9. /// Returns 0 for signals of indeterminate length.
  10. /// </summary>
  11. float SignalDuration { get; }
  12. /// <summary>Get the signal value at a given time relative to signal start</summary>
  13. /// <param name="timeSinceSignalStart">Time since signal start. Always >= 0</param>
  14. /// <param name="pos">output for position component of the signal</param>
  15. /// <param name="rot">output for rotation component of the signal. Use Quaternion.identity if none.</param>
  16. void GetSignal(float timeSinceSignalStart, out Vector3 pos, out Quaternion rot);
  17. }
  18. /// <summary>
  19. /// This is an asset that defines a 6D signal that can be retrieved in a random-access fashion.
  20. /// This is used by the Cinemachine Impulse module.
  21. /// </summary>
  22. [DocumentationSorting(DocumentationSortingAttribute.Level.API)]
  23. public abstract class SignalSourceAsset : ScriptableObject, ISignalSource6D
  24. {
  25. /// <summary>
  26. /// Returns the length on seconds of the signal.
  27. /// Returns 0 for signals of indeterminate length.
  28. /// </summary>
  29. public abstract float SignalDuration { get; }
  30. /// <summary>Get the signal value at a given time relative to signal start</summary>
  31. /// <param name="timeSinceSignalStart">Time since signal start. Always >= 0</param>
  32. /// <param name="pos">output for position component of the signal</param>
  33. /// <param name="rot">output for rotation component of the signal. Use Quaternion.identity if none.</param>
  34. public abstract void GetSignal(
  35. float timeSinceSignalStart, out Vector3 pos, out Quaternion rot);
  36. }
  37. }