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 target; protected override string info{ get{ // string agentName = agent == null ? agentType.ToString() : target.ToString(); return $"{target.ToString()} 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(); if (interactable == null) { return false; } return interactable.CanInteract(); } } }