6 static const string PORT_ENTITY_IN =
"EntityIn";
7 static const string PORT_POSITION_IN =
"PositionIn";
9 [
Attribute(
"", UIWidgets.EditBox,
"Low boundary distance")]
10 private float m_lowBoundary;
12 [
Attribute(
"", UIWidgets.EditBox,
"High boundary distance")]
13 private float m_highBoundary;
15 private bool m_lastValueOfGate =
false;
33 protected override bool TestFunction(AIAgent owner)
35 vector ownerPos,destinationPos;
37 bool openGate =
false;
39 AIGroup ownerIsGroup = AIGroup.Cast(owner);
41 ownerPos = ownerIsGroup.GetLeaderEntity().GetOrigin();
43 ownerPos = owner.GetControlledEntity().GetOrigin();
46 if (!GetVariableIn(PORT_ENTITY_IN, entity))
48 if (!GetVariableIn(PORT_POSITION_IN,destinationPos))
54 destinationPos = entity.GetOrigin();
56 float dist = vector.Distance(destinationPos, ownerPos);
57 if ( dist < m_lowBoundary)
60 m_lastValueOfGate = openGate;
62 else if ( dist > m_highBoundary)
65 m_lastValueOfGate = openGate;
69 openGate = m_lastValueOfGate;
76 protected override bool VisibleInPalette()
82 protected override string GetOnHoverDescription()
84 return "SCR_AIDecoDistanceHysteresis: Checks distance to entity within boundaries and in circumference it returns value according to history of moving";
88 protected static ref TStringArray s_aVarsIn = {
92 protected override TStringArray GetVariablesIn()
98 protected override string GetNodeMiddleText()
102 return "Low boundary: " + m_lowBoundary.ToString() +
"\n" +
"High boundary: " + m_highBoundary.ToString();