Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
Repozitorijs ir arhivēts. Tam var aplūkot failus un to var klonēt, bet nevar iesūtīt jaunas izmaiņas, kā arī atvērt jaunas problēmas/izmaiņu pieprasījumus.

47 rindas
1.3KB

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. /// <summary>
  7. /// Fades the target by the given alpha value. The tartet shaders should support transparency in order to use this action.
  8. /// </summary>
  9. class ActionFadeBy : ActionInterval
  10. {
  11. protected float delta;
  12. public ActionFadeBy(float tgtDelta, float tgtDuration)
  13. : base(tgtDuration)
  14. {
  15. delta = tgtDelta;
  16. }
  17. /// <summary>
  18. /// Returns a copy of the action.
  19. /// </summary>
  20. public override ActionInstant clone()
  21. {
  22. return new ActionFadeBy(delta, duration);
  23. }
  24. /// <summary>
  25. /// Returns the reversed version of the action, if it is possible.
  26. /// </summary>
  27. public override ActionInstant reverse()
  28. {
  29. return new ActionFadeBy(-delta, duration);
  30. }
  31. /// <summary>
  32. /// This method is called every frame update.
  33. /// </summary>
  34. public override void stepInterval(float dt)
  35. {
  36. float d = dt / duration;
  37. Color tgtColor = renderer.material.color;
  38. tgtColor[3] += delta * d;
  39. renderer.material.color = tgtColor;
  40. }
  41. }
  42. }