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.

ActionRotateBy.cs 983B

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