From 97da432c35b8c7aaf9dd2c39e2aa4b1f55f36065 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 27 Jan 2021 16:15:06 +0800 Subject: +behaviour designer --- .../Runtime/Basic Tasks/Input/GetButton.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/Input/GetButton.cs (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/Input/GetButton.cs') diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Input/GetButton.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Input/GetButton.cs new file mode 100644 index 00000000..16ca5592 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Input/GetButton.cs @@ -0,0 +1,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; + } + } +} \ No newline at end of file -- cgit v1.1-26-g67d0