34 lines
963 B
C#
34 lines
963 B
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;
|
|
using BITKit.Sensors;
|
|
using Cysharp.Threading.Tasks;
|
|
namespace BITKit.Nodes
|
|
{
|
|
public class CheckTargetBySensor : ConditionTask
|
|
{
|
|
[BlackboardOnly]
|
|
public BBParameter<Transform> target;
|
|
[BlackboardOnly]
|
|
public BBParameter<List<Transform>> targets;
|
|
EntityHealth entityHealth;
|
|
protected override bool OnCheck()
|
|
{
|
|
if (target.isNoneOrNull is false && targets.value.Contains(target.value))
|
|
{
|
|
if (target.value.TryGetComponent<EntityHealth>(out entityHealth))
|
|
{
|
|
return entityHealth.healthPoint >= 0;
|
|
};
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
} |