您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
此仓库已存档。您可以查看文件和克隆,但不能推送或创建工单/合并请求。

37 行
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. }