選択できるのは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. }