From 72bef9c97b50b391b426bf4cc51381dfc8b26d1c Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 4 Aug 2025 19:03:56 -0400 Subject: [PATCH] added: task to check and save input values --- .../Core/Graph Tasks/CheckInputValue.cs | 42 +++++++++++++++++++ .../Core/Graph Tasks/CheckInputValue.cs.meta | 2 + 2 files changed, 44 insertions(+) create mode 100644 Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs create mode 100644 Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs.meta diff --git a/Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs b/Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs new file mode 100644 index 0000000..2b5f1f4 --- /dev/null +++ b/Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using NodeCanvas.Framework; +using ParadoxNotion; +using ParadoxNotion.Design; +using UnityEngine; +using UnityEngine.InputSystem; + +namespace NodeCanvas.Tasks.Actions { + [Category("Reset/Input")] + [Description("Check if input condition was matched this frame by phase.")] + public class CheckInputValue : ActionTask where T : struct{ + public BBParameter actionName; + public BBParameter outputTo; + + private T value; + + private SignalDefinition signalDefinition; + protected override string info { + get { return $"Get Value of Input: \"{actionName.value}\""; } + } + + protected override string OnInit(){ + try { + signalDefinition = Resources.Load("InputSignal"); + } catch (Exception e) { + Debug.LogError($"Error finding the Input Signal defintion: {e.Message}"); + throw; + } + + return null; + } + + protected override void OnExecute(){ + Debug.Log($"{outputTo.value}, {agent.actions[actionName.value].ReadValue()}"); + + outputTo.value = agent.actions[actionName.value].ReadValue(); + EndAction(); + } + } +} + diff --git a/Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs.meta b/Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs.meta new file mode 100644 index 0000000..fe8e41c --- /dev/null +++ b/Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 055df0fbf696a3149a2d49a8a5392aba