IntAbs.cs 572 B

1234567891011121314151617181920212223
  1. using UnityEngine;
  2. namespace BehaviorDesigner.Runtime.Tasks.Unity.Math
  3. {
  4. [TaskCategory("Unity/Math")]
  5. [TaskDescription("Stores the absolute value of the int.")]
  6. public class IntAbs : Action
  7. {
  8. [Tooltip("The int to return the absolute value of")]
  9. public SharedInt intVariable;
  10. public override TaskStatus OnUpdate()
  11. {
  12. intVariable.Value = Mathf.Abs(intVariable.Value);
  13. return TaskStatus.Success;
  14. }
  15. public override void OnReset()
  16. {
  17. intVariable = 0;
  18. }
  19. }
  20. }