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

55 行
1.3KB

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. class ActionScaleBy : ActionInterval
  7. {
  8. protected Vector3 delta;
  9. protected Vector3 path;
  10. public ActionScaleBy(Vector3 tgtDelta, float tgtDuration)
  11. : base(tgtDuration)
  12. {
  13. delta = tgtDelta;
  14. }
  15. public ActionScaleBy(Vector2 tgtValue, float tgtDuration)
  16. : this((Vector3)tgtValue, tgtDuration)
  17. {
  18. }
  19. public override ActionInstant clone()
  20. {
  21. return new ActionScaleBy(delta, duration);
  22. }
  23. public override ActionInstant reverse()
  24. {
  25. return new ActionScaleBy(delta * -1F, duration);
  26. }
  27. public override void start()
  28. {
  29. base.start();
  30. Vector3 scale = transform.localScale;
  31. scale.x *= delta.x;
  32. scale.y *= delta.y;
  33. scale.z *= delta.z;
  34. path = scale - transform.localScale;
  35. }
  36. public override void stepInterval(float dt)
  37. {
  38. float d = dt / duration;
  39. Vector3 tgt = path * d;
  40. transform.localScale += tgt;
  41. }
  42. public override void stop()
  43. {
  44. base.stop();
  45. }
  46. }
  47. }