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.

39 lines
862B

  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 targetValue)
  13. : base()
  14. {
  15. value = targetValue;
  16. }
  17. public ActionSetRotation(float angle)
  18. : this(new Vector3(0, 0, angle))
  19. {
  20. locks = Axises.rxy;
  21. }
  22. public override ActionInstant Clone()
  23. {
  24. return new ActionSetRotation(value);
  25. }
  26. public override void Start()
  27. {
  28. base.Start();
  29. if (locks != Axises.none)
  30. LockAxises(ref value);
  31. transform.rotation = Quaternion.Euler(value);
  32. }
  33. }
  34. }