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.

37 Zeilen
837B

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. class ActionRotateBy : ActionInterval
  5. {
  6. protected Vector3 delta;
  7. public ActionRotateBy(Vector3 tgtDelta, float tgtDuration)
  8. : base(tgtDuration)
  9. {
  10. delta = tgtDelta;
  11. }
  12. public ActionRotateBy(float angle, float tgtDuration)
  13. : this(new Vector3(0, 0, angle), tgtDuration)
  14. {
  15. is2d = true;
  16. }
  17. public override Action clone()
  18. {
  19. return new ActionRotateBy(delta, duration);
  20. }
  21. public override Action reverse()
  22. {
  23. return new ActionRotateBy(delta * -1F, duration);
  24. }
  25. public override void stepInterval(float dt)
  26. {
  27. float d = dt / duration;
  28. Vector3 tgt = delta * d;
  29. transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + tgt);
  30. }
  31. }