using System.Collections; using System.Collections.Generic; using UnityEngine; using NodeCanvas.BehaviourTrees; using NodeCanvas.Framework; using ParadoxNotion.Design; using NodeCanvas.Tasks.Actions; using BITKit; using System.Linq; using BITKit.Entities; namespace BITKit.Nodes { public class TargetsIsValid : ConditionTask { [BlackboardOnly] public BBParameter> targets; [BlackboardOnly] public BBParameter> validTargets; public string needTag; public string withOutTag; protected override bool OnCheck() { var list = targets.value .SelectWhere(x => x.GetComponent()) .Where(x => x.healthPoint >= 0) .Where(x=>x.HasTag(needTag)) .Where(x=>x.HasTag(withOutTag) is false) .Select(x => x.gameObject) .ToList(); validTargets.SetValue(list); return list.Count > 0; } } }