35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
|
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<List<GameObject>> targets;
|
||
|
[BlackboardOnly]
|
||
|
public BBParameter<List<GameObject>> validTargets;
|
||
|
|
||
|
public string needTag;
|
||
|
public string withOutTag;
|
||
|
protected override bool OnCheck()
|
||
|
{
|
||
|
var list = targets.value
|
||
|
.SelectWhere(x => x.GetComponent<EntityHealth>())
|
||
|
.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;
|
||
|
}
|
||
|
}
|
||
|
}
|