Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
Dieses Repo ist archiviert. Du kannst Dateien sehen und es klonen, kannst aber nicht pushen oder Issues/Pull-Requests öffnen.

41 Zeilen
882B

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