BITFALL/Assets/BITKit/UnityPluginsSupport/NodeCanvas/TargetIsAlive.cs

26 lines
575 B
C#
Raw Normal View History

2023-08-12 01:43:24 +08:00
using System.Collections;
using System.Collections.Generic;
using BITKit.Entities;
using UnityEngine;
using NodeCanvas.Tasks;
using NodeCanvas.Framework;
using BITKit.SubSystems;
using BITKit.SubSystems.Quest;
using NodeCanvas.BehaviourTrees;
namespace BITKit
{
public class TargetIsAlive : ConditionTask
{
public BBParameter<GameObject> target;
protected override bool OnCheck()
{
2023-10-20 19:31:12 +08:00
if (target.isNoneOrNull) return false;
2023-08-12 01:43:24 +08:00
if (target.value.transform.TryGetComponent<IHealth>(out var health))
{
return health.HealthPoint >= 0;
}
return true;
}
}
}