diff options
Diffstat (limited to 'game/server/tf/bot/behavior/tf_bot_taunt.cpp')
| -rw-r--r-- | game/server/tf/bot/behavior/tf_bot_taunt.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/game/server/tf/bot/behavior/tf_bot_taunt.cpp b/game/server/tf/bot/behavior/tf_bot_taunt.cpp new file mode 100644 index 0000000..b0034fa --- /dev/null +++ b/game/server/tf/bot/behavior/tf_bot_taunt.cpp @@ -0,0 +1,53 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// tf_bot_taunt.cpp +// Stand still and play a taunt animation +// Michael Booth, November 2009 + +#include "cbase.h" +#include "team.h" +#include "bot/tf_bot.h" +#include "bot/behavior/tf_bot_taunt.h" + + +//--------------------------------------------------------------------------------------------- +ActionResult< CTFBot > CTFBotTaunt::OnStart( CTFBot *me, Action< CTFBot > *priorAction ) +{ + // wait a short random time so entire mob doesn't taunt in unison + m_tauntTimer.Start( RandomFloat( 0, 1.0f ) ); + m_didTaunt = false; + + return Continue(); +} + + +//--------------------------------------------------------------------------------------------- +ActionResult< CTFBot > CTFBotTaunt::Update( CTFBot *me, float interval ) +{ + if ( m_tauntTimer.IsElapsed() ) + { + if ( m_didTaunt ) + { + // Stop taunting after a while + if ( m_tauntEndTimer.IsElapsed() && me->m_Shared.GetTauntIndex() == TAUNT_LONG ) + { + me->EndLongTaunt(); + } + + if ( me->m_Shared.InCond( TF_COND_TAUNTING ) == false ) + { + return Done( "Taunt finished" ); + } + } + else + { + me->HandleTauntCommand(); + // Start a timer to end our taunt in case we're still going after awhile + m_tauntEndTimer.Start( RandomFloat( 3.f, 5.f ) ); + + m_didTaunt = true; + } + } + + return Continue(); +} + |