You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
703 B

using System.Linq;
using BehaviorDesigner.Runtime.Tasks;
using UnityEngine;
namespace CoreGame.Render
{
/// <summary>
/// 自身生命值低于X
/// </summary>
public class HP_Less_Than : Conditional
{
[SerializeField] private float percent;
public override TaskStatus OnUpdate()
{
var ownerEnt = (CombatEntity)(Owner.GetEntity<CombatEntity>());
var CurHP = ownerEnt.property.GetProperty(PropertyDef.CurHp);
var TotalHP = ownerEnt.property.TotalHp;
if (CurHP / TotalHP <= percent)
{
return TaskStatus.Success;
}
return TaskStatus.Failure;
}
}
}