4 protected SCR_AICombatComponent m_CombatComponent;
6 protected static const string ENEMY_ENTITY_PORT =
"EntityOut";
7 protected static const string ENEMY_LAST_SEEN_POS_PORT =
"EntityLastSeenPos";
8 protected static const string ENEMY_LAST_SEEN_TIME_PORT =
"EntityLastSeenTime";
9 protected static const string ENEMY_TARGET_INFO_PORT =
"TargetInfoOut";
11 ref SCR_AITargetInfo m_TargetInfo;
14 protected override void OnInit(AIAgent owner)
16 m_CombatComponent = SCR_AICombatComponent.Cast(owner.GetControlledEntity().FindComponent(SCR_AICombatComponent));
21 protected BaseTarget GetEnemy(SCR_AICombatComponent combatComp);
25 protected override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
27 if (!m_CombatComponent)
28 return ENodeResult.FAIL;
30 BaseTarget targetEnemy = GetEnemy(m_CombatComponent);
35 IEntity entEnemy = targetEnemy.GetTargetEntity();
40 m_TargetInfo =
new SCR_AITargetInfo();
41 m_TargetInfo.Init(entEnemy, worldPos: targetEnemy.GetLastSeenPosition(), timestamp: targetEnemy.GetTimeLastSeen());
43 SetVariableOut(ENEMY_ENTITY_PORT, entEnemy);
44 SetVariableOut(ENEMY_LAST_SEEN_POS_PORT, m_TargetInfo.m_vWorldPos);
45 SetVariableOut(ENEMY_LAST_SEEN_TIME_PORT, m_TargetInfo.m_fTimestamp);
46 SetVariableOut(ENEMY_TARGET_INFO_PORT, m_TargetInfo);
47 return ENodeResult.SUCCESS;
51 protected ENodeResult Fail()
54 SetVariableOut(ENEMY_ENTITY_PORT, _enemy);
55 ClearVariable(ENEMY_LAST_SEEN_POS_PORT);
56 ClearVariable(ENEMY_LAST_SEEN_TIME_PORT);
57 ClearVariable(ENEMY_TARGET_INFO_PORT);
58 return ENodeResult.FAIL;
62 static ref TStringArray s_aVarsOut =
65 ENEMY_LAST_SEEN_POS_PORT,
66 ENEMY_LAST_SEEN_TIME_PORT,
67 ENEMY_TARGET_INFO_PORT
69 protected override TStringArray GetVariablesOut()
75 override bool VisibleInPalette() {
return false;}
82 protected static override string GetOnHoverDescription()
84 return "Returns current enemy from SCR_AICombatComponent.GetCurrentTarget()";
88 override protected BaseTarget GetEnemy(SCR_AICombatComponent combatComp)
90 return combatComp.GetCurrentTarget();
94 override bool VisibleInPalette() {
return true;}
101 protected static override string GetOnHoverDescription()
103 return "Returns current enemy from SCR_AICombatComponent.GetLastSeenEnemy()";
107 override protected BaseTarget GetEnemy(SCR_AICombatComponent combatComp)
109 return combatComp.GetLastSeenEnemy();
113 override bool VisibleInPalette() {
return true;}