15class BotHunt
extends BotStateBase
18 float m_dtAccumulator = 0.0;
20 ref BotHunt_Tracking m_Tracking;
21 ref BotHunt_Hunting m_Hunting;
23 void BotHunt (
Bot bot = NULL, BotStateBase parent = NULL)
28 m_Tracking =
new BotHunt_Tracking(m_Bot,
this);
29 m_Hunting =
new BotHunt_Hunting(m_Bot,
this);
36 m_FSM.AddTransition(
new BotTransition( m_Tracking, __InSight__, m_Hunting));
37 m_FSM.AddTransition(
new BotTransition( m_Hunting, __Lost__ , m_Tracking));
39 m_FSM.SetInitialState(m_Tracking);
45 m_Tracking.m_Target = m_Target;
46 m_Hunting.m_Target = m_Target;
47 botDebugPrint(
"[bot] + " + m_Owner +
" hunt SelectTarget target=" + m_Target);
52 m_dtAccumulator = 0.0;
60 m_dtAccumulator = 0.0;
70 m_dtAccumulator += dt;
79 int acc = m_dtAccumulator;
82 Print(
"Searching...");
92 bool m_TargetInSight =
false;
93 bool m_TargetLost =
false;
94 bool m_Tracking =
true;
100 m_TargetLost =
false;
101 m_TargetInSight =
false;
105 override void OnAbort (BotEventBase e)
107 m_TargetLost =
false;
108 m_TargetInSight =
false;
114 override void OnExit (BotEventBase e)
116 m_TargetLost =
false;
117 m_TargetInSight =
false;
128 vector targetPos =
m_Target.GetPosition();
135 m_TargetInSight =
true;
139 m_TargetInSight =
false;
142 if (!m_TargetInSight)
144 GetPlayerOwner().GetInputController().OverrideMovementSpeed(
true, 1);
145 GetPlayerOwner().GetInputController().OverrideMovementAngle(
true, 1);
149 GetPlayerOwner().GetInputController().OverrideMovementSpeed(
false, 0);
150 GetPlayerOwner().GetInputController().OverrideMovementAngle(
false, 0);
164 m_TargetInSight =
false;
167 GetPlayerOwner().GetInputController().OverrideMovementSpeed(
false, 0);
168 GetPlayerOwner().GetInputController().OverrideMovementAngle(
false, 0);
178 override void OnEntry (BotEventBase e)
183 override void OnAbort (BotEventBase e) { super.OnAbort(e); }
185 override void OnExit (BotEventBase e)
218 vector pos = bot.GetPosition();
223 g_Game.GetObjectsAtPosition(pos, 100.0, objects, proxyCargos);
225 float min_dist = 1234567.0;
227 int c = objects.Count();
228 for (
int i = 0; i < c; i++)
234 float d =
vector.Distance(o.GetPosition(), bot.GetPosition());
244 botDebugPrint(
"[bot] + " + bot +
" BotSelectNearestTarget idx=" + min_index +
" dist=" + min_dist +
" obj=" + o);
245 return Man.Cast( objects.Get(min_index) );
ref ActionTarget m_Target
void botDebugPrint(string s)
Man BotSelectNearestTarget(EntityAI bot)
FSMTransition< BotStateBase, BotEventBase, BotActionBase, BotGuardBase > BotTransition
represents event that triggers transition from state to state
Bot Finite State Machine (Hierarchical).
represent weapon state base
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto void Print(void var)
Prints content of variable to console/log.
vector GetPosition()
Get the world position of the Effect.
HandStateEquipped OnEntry
enum ProcessDirectDamageFlags m_Owner
class WeaponChambering_Chamber_OnEntry extends WeaponChambering_Base OnExit