SetTimeScale.cs 548 B

1234567891011121314151617181920212223
  1. using UnityEngine;
  2. namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTime
  3. {
  4. [TaskCategory("Unity/Time")]
  5. [TaskDescription("Sets the scale at which time is passing.")]
  6. public class SetTimeScale : Action
  7. {
  8. [Tooltip("The timescale")]
  9. public SharedFloat timeScale;
  10. public override TaskStatus OnUpdate()
  11. {
  12. Time.timeScale = timeScale.Value;
  13. return TaskStatus.Success;
  14. }
  15. public override void OnReset()
  16. {
  17. timeScale.Value = 0;
  18. }
  19. }
  20. }