LMotion.Punch.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using UnityEngine;
  2. using LitMotion.Adapters;
  3. namespace LitMotion
  4. {
  5. public static partial class LMotion
  6. {
  7. /// <summary>
  8. /// API for creating Punch motions.
  9. /// </summary>
  10. public static class Punch
  11. {
  12. /// <summary>
  13. /// Create a builder for building Punch motion.
  14. /// </summary>
  15. /// <param name="startValue">Start value</param>
  16. /// <param name="strength">Vibration strength</param>
  17. /// <param name="duration">Duration</param>
  18. /// <returns>Created motion builder</returns>
  19. public static MotionBuilder<float, PunchOptions, FloatPunchMotionAdapter> Create(float startValue, float strength, float duration)
  20. {
  21. return Create<float, PunchOptions, FloatPunchMotionAdapter>(startValue, strength, duration)
  22. .WithOptions(PunchOptions.Default);
  23. }
  24. /// <summary>
  25. /// Create a builder for building Punch motion.
  26. /// </summary>
  27. /// <param name="startValue">Start value</param>
  28. /// <param name="strength">Vibration strength</param>
  29. /// <param name="duration">Duration</param>
  30. /// <returns>Created motion builder</returns>
  31. public static MotionBuilder<Vector2, PunchOptions, Vector2PunchMotionAdapter> Create(Vector2 startValue, Vector2 strength, float duration)
  32. {
  33. return Create<Vector2, PunchOptions, Vector2PunchMotionAdapter>(startValue, strength, duration)
  34. .WithOptions(PunchOptions.Default);
  35. }
  36. /// <summary>
  37. /// Create a builder for building Punch motion.
  38. /// </summary>
  39. /// <param name="startValue">Start value</param>
  40. /// <param name="strength">Vibration strength</param>
  41. /// <param name="duration">Duration</param>
  42. /// <returns>Created motion builder</returns>
  43. public static MotionBuilder<Vector3, PunchOptions, Vector3PunchMotionAdapter> Create(Vector3 startValue, Vector3 strength, float duration)
  44. {
  45. return Create<Vector3, PunchOptions, Vector3PunchMotionAdapter>(startValue, strength, duration)
  46. .WithOptions(PunchOptions.Default);
  47. }
  48. }
  49. }
  50. }