using NodeCanvas.Framework; using ParadoxNotion.Design; using UnityEngine; namespace NodeCanvas.Tasks.Actions { [Category("Input (Legacy System)")] public class GetInputAxis : ActionTask { public BBParameter xAxisName = "Horizontal"; public BBParameter yAxisName; public BBParameter zAxisName = "Vertical"; public BBParameter multiplier = 1; [BlackboardOnly] public BBParameter saveAs; [BlackboardOnly] public BBParameter saveXAs; [BlackboardOnly] public BBParameter saveYAs; [BlackboardOnly] public BBParameter saveZAs; public bool repeat; protected override void OnExecute() { Do(); } protected override void OnUpdate() { Do(); } void Do() { var x = string.IsNullOrEmpty(xAxisName.value) ? 0 : Input.GetAxis(xAxisName.value); var y = string.IsNullOrEmpty(yAxisName.value) ? 0 : Input.GetAxis(yAxisName.value); var z = string.IsNullOrEmpty(zAxisName.value) ? 0 : Input.GetAxis(zAxisName.value); saveXAs.value = x * multiplier.value; saveYAs.value = y * multiplier.value; saveZAs.value = z * multiplier.value; saveAs.value = new Vector3(x, y, z) * multiplier.value; if ( !repeat ) { EndAction(); } } } }