blob: 16ca5592308e3b60156445e8fafb87b44fc5b927 (
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
32
33
34
|
using UnityEngine;
#if CROSS_PLATFORM_INPUT
using UnityStandardAssets.CrossPlatformInput;
#endif
namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityInput
{
[TaskCategory("Basic/Input")]
[TaskDescription("Stores the state of the specified button.")]
public class GetButton : Action
{
[Tooltip("The name of the button")]
public SharedString buttonName;
[RequiredField]
[Tooltip("The stored result")]
public SharedBool storeResult;
public override TaskStatus OnUpdate()
{
#if CROSS_PLATFORM_INPUT
storeResult.Value = CrossPlatformInputManager.GetButton(buttonName.Value);
#else
storeResult.Value = Input.GetButton(buttonName.Value);
#endif
return TaskStatus.Success;
}
public override void OnReset()
{
buttonName = "Fire1";
storeResult = false;
}
}
}
|