You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

43 lines
959B

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. /// <summary>
  7. /// Instantly rotates the target.
  8. /// </summary>
  9. class ActionSetRotation : ActionInstant
  10. {
  11. protected Vector3 value;
  12. public ActionSetRotation(Vector3 tgtValue)
  13. : base()
  14. {
  15. value = tgtValue;
  16. }
  17. public ActionSetRotation(float angle)
  18. : this(new Vector3(0, 0, angle))
  19. {
  20. is2d = true;
  21. }
  22. /// <summary>
  23. /// Returns a copy of the action.
  24. /// </summary>
  25. public override ActionInstant clone()
  26. {
  27. return new ActionSetRotation(value);
  28. }
  29. /// <summary>
  30. /// This method is called at the action start.
  31. /// </summary>
  32. public override void start()
  33. {
  34. base.start();
  35. transform.rotation = Quaternion.Euler(value);
  36. }
  37. }
  38. }