Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Este repositório está arquivado. Você pode visualizar os arquivos e realizar clone, mas não poderá realizar push nem abrir issues e pull requests.

43 linhas
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. }