選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
このリポジトリはアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュや、課題・プルリクエストのオープンはできません。

34 行
714B

  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 override Action clone()
  14. {
  15. return new ActionMoveBy(value, duration);
  16. }
  17. public override void start()
  18. {
  19. base.start();
  20. path = value - target.gameObject.transform.position;
  21. }
  22. public override void stepInterval(float dt)
  23. {
  24. float d = dt / duration;
  25. Vector3 tgt = path * d;
  26. target.gameObject.transform.Translate(tgt, Space.World);
  27. }
  28. }