SetSharedInt.cs 737 B

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