Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
Dieses Repo ist archiviert. Du kannst Dateien sehen und es klonen, kannst aber nicht pushen oder Issues/Pull-Requests öffnen.

44 Zeilen
1.0KB

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. class ActionScaleTo : ActionInterval
  7. {
  8. protected Vector3 value;
  9. protected Vector3 path;
  10. public ActionScaleTo(Vector3 tgtValue, float tgtDuration)
  11. : base(tgtDuration)
  12. {
  13. value = tgtValue;
  14. }
  15. public ActionScaleTo(Vector2 tgtValue, float tgtDuration)
  16. : this((Vector3)tgtValue, tgtDuration)
  17. {
  18. is2d = true;
  19. }
  20. public override ActionInstant clone()
  21. {
  22. return new ActionScaleTo(value, duration);
  23. }
  24. public override void start()
  25. {
  26. base.start();
  27. if (is2d)
  28. value.z = transform.localScale.z;
  29. path = value - transform.localScale;
  30. }
  31. public override void stepInterval(float dt)
  32. {
  33. float d = dt / duration;
  34. Vector3 tgt = path * d;
  35. transform.localScale += tgt;
  36. }
  37. }
  38. }