summaryrefslogtreecommitdiff
path: root/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Math/IntAbs.cs
blob: 05f972501736b61bba929e2e29d33eadc34f482a (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.Math
{
    [TaskCategory("Basic/Math")]
    [TaskDescription("Stores the absolute value of the int.")]
    public class IntAbs : Action
    {
        [Tooltip("The int to return the absolute value of")]
        public SharedInt intVariable;

        public override TaskStatus OnUpdate()
        {
            intVariable.Value = Mathf.Abs(intVariable.Value);
            return TaskStatus.Success;
        }

        public override void OnReset()
        {
            intVariable = 0;
        }
    }
}