Files
project-reset/Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs
2025-08-08 14:22:32 -04:00

43 lines
1.1 KiB
C#

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<T> : ActionTask<PlayerInput> where T : struct{
public BBParameter<string> actionName;
public BBParameter<T> outputTo;
private T value;
private SignalDefinition signalDefinition;
protected override string info {
get { return $"Get Value of <b>Input:</b> \"{actionName.value}\""; }
}
protected override string OnInit(){
try {
signalDefinition = Resources.Load<SignalDefinition>("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<T>()}");
outputTo.value = agent.actions[actionName.value].ReadValue<T>();
EndAction();
}
}
}