added: new tasks for interactions with units

This commit is contained in:
Chris
2025-10-20 13:45:23 -04:00
parent 0240f677c4
commit 77fcd2059a
6 changed files with 170 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace Reset.Core {
[Category("Reset")]
[Description("Checks if the object has IInteractable and if the interactable object is available for use.")]
public class IsInteractable : ConditionTask{
public BBParameter<GameObject> target;
protected override string info{
get{
// string agentName = agent == null ? agentType.ToString() : target.ToString();
return $"<b>{target.ToString()}</b> is interactable";
}
}
//Use for initialization. This is called only once in the lifetime of the task.
//Return null if init was successfull. Return an error string otherwise
protected override string OnInit(){
return null;
}
//Called whenever the condition gets enabled.
protected override void OnEnable() {
}
//Called whenever the condition gets disabled.
protected override void OnDisable() {
}
//Called once per frame while the condition is active.
//Return whether the condition is success or failure.
protected override bool OnCheck(){
IInteractable interactable = agent.GetComponent<IInteractable>();
if (interactable == null) {
return false;
}
return interactable.CanInteract();
}
}
}