37 lines
934 B
C#
37 lines
934 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;
|
|
namespace BITKit.Nodes
|
|
{
|
|
public class TargetIsValid : ConditionTask
|
|
{
|
|
[BlackboardOnly]
|
|
public BBParameter<GameObject> target;
|
|
EntityHealth entityHealth;
|
|
protected override bool OnCheck()
|
|
{
|
|
if (target.isNoneOrNull)
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
if (target.value.TryGetComponent<EntityHealth>(out entityHealth))
|
|
{
|
|
if (entityHealth.healthPoint >= 0)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |