3 [
Attribute(
"1", UIWidgets.EditBox,
"Filter target by how long ago it was seen",
"")]
4 float m_fTimeSinceSeenMax;
6 [
Attribute(
"20", UIWidgets.EditBox,
"Filter target by how far it can be",
"")]
7 float m_fDetectionRange;
12 protected static const string PORT_BASE_TARGET =
"BaseTarget";
14 protected PerceptionComponent m_PerceptionComp;
19 override bool VisibleInPalette()
24 protected override string GetNodeMiddleText()
26 return "LastSeenMax: " + m_fTimeSinceSeenMax.ToString() +
"\n" +
27 "TargetCategory: " +
typename.EnumToString(
ETargetCategory, m_eTargetType);
30 override void OnInit(AIAgent owner)
36 m_PerceptionComp = PerceptionComponent.Cast(ent.FindComponent(PerceptionComponent));
39 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
41 BaseTarget baseTarget = m_PerceptionComp.GetClosestTarget(m_eTargetType, m_fTimeSinceSeenMax, m_fTimeSinceSeenMax);
43 if (!baseTarget || baseTarget.GetDistance() > m_fDetectionRange)
44 return ENodeResult.FAIL;
48 m_Shape = Shape.CreateSphere(COLOR_BLUE_A, ShapeFlags.NOOUTLINE|ShapeFlags.NOZBUFFER|ShapeFlags.TRANSP, baseTarget.GetLastSeenPosition(), 0.1);
50 SetVariableOut(PORT_BASE_TARGET, baseTarget);
51 return ENodeResult.SUCCESS;
54 protected static ref TStringArray s_aVarsOut = {
57 override TStringArray GetVariablesOut()