5 bool CheckTrigger () {
return false; }
12 override bool CheckTrigger () {
return null !=
m_Owner.GetInventory().FindAttachment(
InventorySlots.GetSlotIdFromString(
"Headgear")); }
22 protected const float c_TriggerTimeoutMS = 1000.0;
24 protected const float c_UpdateMS = 16.0;
25 protected ref
BotFSM m_FSM =
null;
26 protected bool m_UseTrigger =
false;
27 protected bool m_Triggered =
false;
39 void Start (
bool use_trigger,
BotTrigger trigger =
null)
41 m_UseTrigger = use_trigger;
47 if (m_UseTrigger && trigger ==
null)
48 Error(
"use trigger, but trigger null");
51 m_BotTrigger = trigger;
53 m_Timer.Run(c_TriggerTimeoutMS / 1000.0,
this,
"OnTrigger",
null,
true);
58 m_Timer.Run(c_UpdateMS / 1000.0,
this,
"OnTimer",
null,
true);
62 void DelayedStart (
float ms)
64 m_Timer.Run(ms / 1000.0,
this,
"OnDelayedStart",
null,
false);
67 protected void OnDelayedStart ()
82 protected void OnTrigger ()
84 bool triggered = m_BotTrigger.CheckTrigger();
93 m_Timer.Run(c_UpdateMS / 1000.0,
this,
"OnUpdate",
null,
true);
105 m_Timer.Run(c_TriggerTimeoutMS / 1000.0,
this,
"OnTrigger",
null,
true);
112 void OnUpdate (
float dt)
114 m_FSM.GetCurrentState().OnUpdate(dt);
152 m_FSM.AddTransition(
new BotTransition( BotIdle , ___Bgn__, m_BotTest));
153 m_FSM.AddTransition(
new BotTransition( BotIdle , __Stop__, NULL));
159 m_FSM.AddTransition(
new BotTransition(m_BotTest , __Fail__, BotIdle));
160 m_FSM.AddTransition(
new BotTransition(m_BotTest , __Tout__, BotIdle));
163 m_FSM.SetInitialState(BotIdle);
171 botDebugSpam(
"[botfsm] Processed event e=" + e.ToString());
176 botDebugSpam(
"[botfsm] FSM refused to process event (no transition): src=" + m_FSM.GetCurrentState().ToString() +
" event=" + e.ToString());
193 #ifdef BOT_DEBUG_SPAM