SetSharedRect.cs 781 B

12345678910111213141516171819202122232425262728
  1. using UnityEngine;
  2. namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables
  3. {
  4. [TaskCategory("Unity/SharedVariable")]
  5. [TaskDescription("Sets the SharedRect variable to the specified object. Returns Success.")]
  6. public class SetSharedRect : Action
  7. {
  8. [Tooltip("The value to set the SharedRect to")]
  9. public SharedRect targetValue;
  10. [RequiredField]
  11. [Tooltip("The SharedRect to set")]
  12. public SharedRect targetVariable;
  13. public override TaskStatus OnUpdate()
  14. {
  15. targetVariable.Value = targetValue.Value;
  16. return TaskStatus.Success;
  17. }
  18. public override void OnReset()
  19. {
  20. targetValue = new Rect();
  21. targetVariable = new Rect();
  22. }
  23. }
  24. }