summaryrefslogtreecommitdiff
path: root/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Time/GetTime.cs
blob: f0585de6a3a651fc037c36101a7e83f1ffa12628 (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("Returns the time in second since the start of the game.")]
    public class GetTime : Action
    {
        [Tooltip("The variable to store the result")]
        public SharedFloat storeResult;

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

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