Files
VOIDRPG/Assets/90 - Scripts/Generic/AI/Schema/Conditionals/IsPatrolDefined.cs
T
2026-07-09 21:33:33 +02:00

26 lines
844 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.ThisUnit)]
public class IsPatrolDefined : Conditional
{
public override bool Evaluate(object nodeMemory, SchemaAgent agent)
{
return (agent as UnitObjectSchemaAgent)?.unitAI.patrol.Count > 1;
}
public override GUIContent GetConditionalContent()
{
var sb = new StringBuilder();
if (invert) sb.Append("<color=red>NOT</color> ");
sb.Append($"<color=red>{nameof(UnitObjectSenses)}</color> has at least two <color=red>patrol</color> points");
return new GUIContent(sb.ToString());
}
}
}