BoolFlip.cs 540 B

123456789101112131415161718192021
  1. namespace BehaviorDesigner.Runtime.Tasks.Unity.Math
  2. {
  3. [TaskCategory("Unity/Math")]
  4. [TaskDescription("Flips the value of the bool.")]
  5. public class BoolFlip : Action
  6. {
  7. [Tooltip("The bool to flip the value of")]
  8. public SharedBool boolVariable;
  9. public override TaskStatus OnUpdate()
  10. {
  11. boolVariable.Value = !boolVariable.Value;
  12. return TaskStatus.Success;
  13. }
  14. public override void OnReset()
  15. {
  16. boolVariable.Value = false;
  17. }
  18. }
  19. }