using System.Collections; using System.Collections.Generic; using BITKit; using NodeCanvas.BehaviourTrees; using UnityEngine; namespace BITFALL.Scene { public class ActionBasedNodeCondition : ActionBasedComponent { [SerializeReference, SubclassSelector] private ICondition startCondition; protected override void OnEnable() { base.OnEnable(); actionBasedObject.OnStarted += OnStart; } protected override void OnDisable() { base.OnDisable(); actionBasedObject.OnStarted -= OnStart; } private void OnStart() { if (startCondition is not null && startCondition.OnCheck() is false) { throw new InGameException(startCondition.Reason); } } } }