Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
Tento repozitář je archivovaný. Můžete prohlížet soubory, klonovat, ale nemůžete nahrávat a vytvářet nové úkoly a požadavky na natažení.

34 řádky
777B

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. class ActionFadeTo : ActionInterval
  5. {
  6. public float value;
  7. public float delta;
  8. public ActionFadeTo(float tgtValue, float tgtDuration)
  9. : base(tgtDuration)
  10. {
  11. value = tgtValue;
  12. }
  13. public override Action clone()
  14. {
  15. return new ActionFadeTo(value, duration);
  16. }
  17. public override void start()
  18. {
  19. base.start();
  20. delta = value - target.gameObject.renderer.material.color.a;
  21. }
  22. public override void stepInterval(float dt)
  23. {
  24. float d = dt / duration;
  25. Color tgtColor = target.gameObject.renderer.material.color;
  26. tgtColor[3] += delta * d;
  27. target.gameObject.renderer.material.color = tgtColor;
  28. }
  29. }