summaryrefslogtreecommitdiff
path: root/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Time/SetTimeScale.cs
blob: e02937e0043864330e7a9d8db681572b94277c86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using UnityEngine;

namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityTime
{
    [TaskCategory("Basic/Time")]
    [TaskDescription("Sets the scale at which time is passing.")]
    public class SetTimeScale : Action
    {
        [Tooltip("The timescale")]
        public SharedFloat timeScale;

        public override TaskStatus OnUpdate()
        {
            Time.timeScale = timeScale.Value;
            return TaskStatus.Success;
        }

        public override void OnReset()
        {
            timeScale.Value = 0;
        }
    }
}