summaryrefslogtreecommitdiff
path: root/Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Input/OnAxis.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-14 22:50:43 +0800
committerchai <chaifix@163.com>2019-08-14 22:50:43 +0800
commit15740faf9fe9fe4be08965098bbf2947e096aeeb (patch)
treea730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Input/OnAxis.cs
+Unity Runtime codeHEADmaster
Diffstat (limited to 'Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Input/OnAxis.cs')
-rw-r--r--Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Input/OnAxis.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Input/OnAxis.cs b/Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Input/OnAxis.cs
new file mode 100644
index 0000000..f9bdcb6
--- /dev/null
+++ b/Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Input/OnAxis.cs
@@ -0,0 +1,37 @@
+using UnityEngine;
+
+namespace UnityEngine.Graphs.LogicGraph
+{
+ public partial class InputNodes
+ {
+ [Logic]
+ [Title("Input/On Axis")]
+ public sealed class OnAxis : OnInputNode
+ {
+ private float m_Value;
+ public float value { get { return m_Value; } }
+
+ private string m_AxisName;
+ public string axisName { set { m_AxisName = value; } }
+
+ public OnAxis (GraphBehaviour graphBehaviour) : base (graphBehaviour) { }
+ public OnAxis (IMonoBehaviourEventCaller graphBehaviour, string axisName) : base (graphBehaviour)
+ {
+ m_AxisName = axisName;
+ }
+
+ protected override void OnUpdate ()
+ {
+ if (down == null && up == null)
+ return;
+
+ m_Value = Input.GetAxis (m_AxisName);
+
+ var stateDelegate = Input.GetButton (m_AxisName) ? down : up;
+ if (stateDelegate != null)
+ stateDelegate ();
+ }
+ }
+ }
+}
+