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

48 行
1.3KB

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. class ActionSkewBy : ActionInterval
  7. {
  8. protected Vector3 skewAngles1;
  9. protected Vector3 skewAngles2;
  10. protected Mesh mesh;
  11. public ActionSkewBy(Vector3 tgtAngles1, Vector3 tgtAngles2, float tgtDuration)
  12. : base(tgtDuration)
  13. {
  14. skewAngles1 = tgtAngles1;
  15. skewAngles2 = tgtAngles2;
  16. }
  17. public override ActionInstant clone()
  18. {
  19. return new ActionSkewBy(skewAngles1, skewAngles2, duration);
  20. }
  21. public override ActionInstant reverse()
  22. {
  23. return new ActionSkewBy(-skewAngles1, -skewAngles2, duration);
  24. }
  25. public override void start()
  26. {
  27. base.start();
  28. if (!(target is Actor))
  29. {
  30. throw new Exception("You should use Actor class instead of Actor, if you want to skew your object.");
  31. }
  32. }
  33. public override void stepInterval(float dt)
  34. {
  35. float d = dt / duration;
  36. Vector3 tgt = skewAngles1 * d;
  37. ((Actor)target).skewAngles1 += tgt;
  38. tgt = skewAngles2 * d;
  39. ((Actor)target).skewAngles2 += tgt;
  40. }
  41. }
  42. }