SFX_AnimationModule.cs 756 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Linq;
  3. using UnityEngine;
  4. // ReSharper disable once CheckNamespace
  5. namespace QFX.SFX
  6. {
  7. [Serializable]
  8. public class SFX_AnimationModule
  9. {
  10. public AnimationCurve AnimationCurve = AnimationCurve.EaseInOut(0, 0, 1, 1);
  11. public float ValueMultiplier = 1f;
  12. public float TimeMultiplier = 1f;
  13. public bool IsAnimationFinished { get; set; }
  14. public float Evaluate(float time)
  15. {
  16. var mTime = time / TimeMultiplier;
  17. var lastTime = AnimationCurve.keys.Last().time;
  18. if (mTime > lastTime)
  19. IsAnimationFinished = true;
  20. var eval = AnimationCurve.Evaluate(mTime) * ValueMultiplier;
  21. return eval;
  22. }
  23. }
  24. }