Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Este repositório está arquivado. Você pode visualizar os arquivos e realizar clone, mas não poderá realizar push nem abrir issues e pull requests.

44 linhas
1.0KB

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. class ActionScaleTo : ActionInterval
  7. {
  8. protected Vector3 value;
  9. protected Vector3 path;
  10. public ActionScaleTo(Vector3 tgtValue, float tgtDuration)
  11. : base(tgtDuration)
  12. {
  13. value = tgtValue;
  14. }
  15. public ActionScaleTo(Vector2 tgtValue, float tgtDuration)
  16. : this((Vector3)tgtValue, tgtDuration)
  17. {
  18. is2d = true;
  19. }
  20. public override ActionInstant clone()
  21. {
  22. return new ActionScaleTo(value, duration);
  23. }
  24. public override void start()
  25. {
  26. base.start();
  27. if (is2d)
  28. value.z = transform.localScale.z;
  29. path = value - transform.localScale;
  30. }
  31. public override void stepInterval(float dt)
  32. {
  33. float d = dt / duration;
  34. Vector3 tgt = path * d;
  35. transform.localScale += tgt;
  36. }
  37. }
  38. }