28 lines
849 B
C#
28 lines
849 B
C#
using System.Text;
|
|
using Schema;
|
|
using UnityEngine;
|
|
using VOID.Generic.Objects.Unit;
|
|
|
|
namespace VOID.Generic.AI.Schema.Conditionals
|
|
{
|
|
[DarkIcon("Conditionals/d_IsNull")]
|
|
[LightIcon("Conditionals/IsNull")]
|
|
[Category(SchemaCategory.AnyUnit)]
|
|
public class IsUnitDead : Conditional
|
|
{
|
|
[SerializeField] private BlackboardEntrySelector<UnitObject> _unit;
|
|
|
|
public override bool Evaluate(object nodeMemory, SchemaAgent agent)
|
|
{
|
|
return _unit.value && _unit.value.basicState.isDead;
|
|
}
|
|
|
|
public override GUIContent GetConditionalContent()
|
|
{
|
|
var sb = new StringBuilder();
|
|
if (invert) sb.Append("<color=red>NOT</color> ");
|
|
sb.Append($"If <color=red>{_unit.name}</color> is dead");
|
|
return new GUIContent(sb.ToString());
|
|
}
|
|
}
|
|
} |