FloatAbs.cs 588 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 float.")]
  6. public class FloatAbs : Action
  7. {
  8. [Tooltip("The float to return the absolute value of")]
  9. public SharedFloat floatVariable;
  10. public override TaskStatus OnUpdate()
  11. {
  12. floatVariable.Value = Mathf.Abs(floatVariable.Value);
  13. return TaskStatus.Success;
  14. }
  15. public override void OnReset()
  16. {
  17. floatVariable = 0;
  18. }
  19. }
  20. }