DOTweenModuleEPOOutline.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using UnityEngine;
  2. #if false || EPO_DOTWEEN // MODULE_MARKER
  3. using EPOOutline;
  4. using DG.Tweening.Plugins.Options;
  5. using DG.Tweening;
  6. using DG.Tweening.Core;
  7. namespace DG.Tweening
  8. {
  9. public static class DOTweenModuleEPOOutline
  10. {
  11. public static int DOKill(this SerializedPass target, bool complete)
  12. {
  13. return DOTween.Kill(target, complete);
  14. }
  15. public static TweenerCore<float, float, FloatOptions> DOFloat(this SerializedPass target, string propertyName, float endValue, float duration)
  16. {
  17. var tweener = DOTween.To(() => target.GetFloat(propertyName), x => target.SetFloat(propertyName, x), endValue, duration);
  18. tweener.SetOptions(true).SetTarget(target);
  19. return tweener;
  20. }
  21. public static TweenerCore<Color, Color, ColorOptions> DOFade(this SerializedPass target, string propertyName, float endValue, float duration)
  22. {
  23. var tweener = DOTween.ToAlpha(() => target.GetColor(propertyName), x => target.SetColor(propertyName, x), endValue, duration);
  24. tweener.SetOptions(true).SetTarget(target);
  25. return tweener;
  26. }
  27. public static TweenerCore<Color, Color, ColorOptions> DOColor(this SerializedPass target, string propertyName, Color endValue, float duration)
  28. {
  29. var tweener = DOTween.To(() => target.GetColor(propertyName), x => target.SetColor(propertyName, x), endValue, duration);
  30. tweener.SetOptions(false).SetTarget(target);
  31. return tweener;
  32. }
  33. public static TweenerCore<Vector4, Vector4, VectorOptions> DOVector(this SerializedPass target, string propertyName, Vector4 endValue, float duration)
  34. {
  35. var tweener = DOTween.To(() => target.GetVector(propertyName), x => target.SetVector(propertyName, x), endValue, duration);
  36. tweener.SetOptions(false).SetTarget(target);
  37. return tweener;
  38. }
  39. public static TweenerCore<float, float, FloatOptions> DOFloat(this SerializedPass target, int propertyId, float endValue, float duration)
  40. {
  41. var tweener = DOTween.To(() => target.GetFloat(propertyId), x => target.SetFloat(propertyId, x), endValue, duration);
  42. tweener.SetOptions(true).SetTarget(target);
  43. return tweener;
  44. }
  45. public static TweenerCore<Color, Color, ColorOptions> DOFade(this SerializedPass target, int propertyId, float endValue, float duration)
  46. {
  47. var tweener = DOTween.ToAlpha(() => target.GetColor(propertyId), x => target.SetColor(propertyId, x), endValue, duration);
  48. tweener.SetOptions(true).SetTarget(target);
  49. return tweener;
  50. }
  51. public static TweenerCore<Color, Color, ColorOptions> DOColor(this SerializedPass target, int propertyId, Color endValue, float duration)
  52. {
  53. var tweener = DOTween.To(() => target.GetColor(propertyId), x => target.SetColor(propertyId, x), endValue, duration);
  54. tweener.SetOptions(false).SetTarget(target);
  55. return tweener;
  56. }
  57. public static TweenerCore<Vector4, Vector4, VectorOptions> DOVector(this SerializedPass target, int propertyId, Vector4 endValue, float duration)
  58. {
  59. var tweener = DOTween.To(() => target.GetVector(propertyId), x => target.SetVector(propertyId, x), endValue, duration);
  60. tweener.SetOptions(false).SetTarget(target);
  61. return tweener;
  62. }
  63. public static int DOKill(this Outlinable.OutlineProperties target, bool complete = false)
  64. {
  65. return DOTween.Kill(target, complete);
  66. }
  67. public static int DOKill(this Outliner target, bool complete = false)
  68. {
  69. return DOTween.Kill(target, complete);
  70. }
  71. /// <summary>
  72. /// Controls the alpha (transparency) of the outline
  73. /// </summary>
  74. public static TweenerCore<Color, Color, ColorOptions> DOFade(this Outlinable.OutlineProperties target, float endValue, float duration)
  75. {
  76. var tweener = DOTween.ToAlpha(() => target.Color, x => target.Color = x, endValue, duration);
  77. tweener.SetOptions(true).SetTarget(target);
  78. return tweener;
  79. }
  80. /// <summary>
  81. /// Controls the color of the outline
  82. /// </summary>
  83. public static TweenerCore<Color, Color, ColorOptions> DOColor(this Outlinable.OutlineProperties target, Color endValue, float duration)
  84. {
  85. var tweener = DOTween.To(() => target.Color, x => target.Color = x, endValue, duration);
  86. tweener.SetOptions(false).SetTarget(target);
  87. return tweener;
  88. }
  89. /// <summary>
  90. /// Controls the amount of blur applied to the outline
  91. /// </summary>
  92. public static TweenerCore<float, float, FloatOptions> DOBlurShift(this Outlinable.OutlineProperties target, float endValue, float duration, bool snapping = false)
  93. {
  94. var tweener = DOTween.To(() => target.BlurShift, x => target.BlurShift = x, endValue, duration);
  95. tweener.SetOptions(snapping).SetTarget(target);
  96. return tweener;
  97. }
  98. /// <summary>
  99. /// Controls the amount of blur applied to the outline
  100. /// </summary>
  101. public static TweenerCore<float, float, FloatOptions> DOBlurShift(this Outliner target, float endValue, float duration, bool snapping = false)
  102. {
  103. var tweener = DOTween.To(() => target.BlurShift, x => target.BlurShift = x, endValue, duration);
  104. tweener.SetOptions(snapping).SetTarget(target);
  105. return tweener;
  106. }
  107. /// <summary>
  108. /// Controls the amount of dilation applied to the outline
  109. /// </summary>
  110. public static TweenerCore<float, float, FloatOptions> DODilateShift(this Outlinable.OutlineProperties target, float endValue, float duration, bool snapping = false)
  111. {
  112. var tweener = DOTween.To(() => target.DilateShift, x => target.DilateShift = x, endValue, duration);
  113. tweener.SetOptions(snapping).SetTarget(target);
  114. return tweener;
  115. }
  116. /// <summary>
  117. /// Controls the amount of dilation applied to the outline
  118. /// </summary>
  119. public static TweenerCore<float, float, FloatOptions> DODilateShift(this Outliner target, float endValue, float duration, bool snapping = false)
  120. {
  121. var tweener = DOTween.To(() => target.DilateShift, x => target.DilateShift = x, endValue, duration);
  122. tweener.SetOptions(snapping).SetTarget(target);
  123. return tweener;
  124. }
  125. }
  126. }
  127. #endif