GetRealtimeSinceStartup.cs 611 B

1234567891011121314151617181920212223
  1. using UnityEngine;
  2. namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTime
  3. {
  4. [TaskCategory("Unity/Time")]
  5. [TaskDescription("Returns the real time in seconds since the game started.")]
  6. public class GetRealtimeSinceStartup : Action
  7. {
  8. [Tooltip("The variable to store the result")]
  9. public SharedFloat storeResult;
  10. public override TaskStatus OnUpdate()
  11. {
  12. storeResult.Value = Time.realtimeSinceStartup;
  13. return TaskStatus.Success;
  14. }
  15. public override void OnReset()
  16. {
  17. storeResult.Value = 0;
  18. }
  19. }
  20. }