summaryrefslogtreecommitdiff
path: root/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Vector2/GetXY.cs
blob: a9bae4d002940e48047da7605e538f9d0bff94dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using UnityEngine;

namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityVector2
{
    [TaskCategory("Basic/Vector2")]
    [TaskDescription("Stores the X and Y values of the Vector2.")]
    public class GetXY : Action
    {
        [Tooltip("The Vector2 to get the values of")]
        public SharedVector2 vector2Variable;
        [Tooltip("The X value")]
        [RequiredField]
        public SharedFloat storeX;
        [Tooltip("The Y value")]
        [RequiredField]
        public SharedFloat storeY;

        public override TaskStatus OnUpdate()
        {
            storeX.Value = vector2Variable.Value.x;
            storeY.Value = vector2Variable.Value.y;
            return TaskStatus.Success;
        }

        public override void OnReset()
        {
            vector2Variable = Vector2.zero;
            storeX = storeY = 0;
        }
    }
}