summaryrefslogtreecommitdiff
path: root/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Input/GetMouseButton.cs
blob: 2ffab1fdca3312e09f7d3202919d26a4c1d84dcc (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
using UnityEngine;

namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityInput
{
    [TaskCategory("Basic/Input")]
    [TaskDescription("Stores the state of the specified mouse button.")]
    public class GetMouseButton : Action
    {
        [Tooltip("The index of the button")]
        public SharedInt buttonIndex;
        [RequiredField]
        [Tooltip("The stored result")]
        public SharedBool storeResult;

        public override TaskStatus OnUpdate()
        {
            storeResult.Value = Input.GetMouseButton(buttonIndex.Value);
            return TaskStatus.Success;
        }

        public override void OnReset()
        {
            buttonIndex = 0;
            storeResult = false;
        }
    }
}