No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
Este repositorio está archivado. Puede ver los archivos y clonarlo, pero no puede subir cambios o reportar incidencias ni pedir Pull Requests.

40 líneas
933B

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. class ActionMoveBy : ActionInterval
  7. {
  8. protected Vector3 delta;
  9. public ActionMoveBy(Vector3 tgtDelta, float tgtDuration)
  10. : base(tgtDuration)
  11. {
  12. delta = tgtDelta;
  13. }
  14. public ActionMoveBy(Vector2 tgtValue, float tgtDuration)
  15. : this((Vector3)tgtValue, tgtDuration)
  16. {
  17. is2d = true;
  18. }
  19. public override ActionInstant clone()
  20. {
  21. return new ActionMoveBy(delta, duration);
  22. }
  23. public override ActionInstant reverse()
  24. {
  25. return new ActionMoveBy(delta * -1F, duration);
  26. }
  27. public override void stepInterval(float dt)
  28. {
  29. float d = dt / duration;
  30. Vector3 tgt = delta * d;
  31. transform.Translate(tgt, Space.World);
  32. }
  33. }
  34. }