本文整理汇总了C++中IntervalTimer::GetElapsedTime方法的典型用法代码示例。如果您正苦于以下问题:C++ IntervalTimer::GetElapsedTime方法的具体用法?C++ IntervalTimer::GetElapsedTime怎么用?C++ IntervalTimer::GetElapsedTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IntervalTimer
的用法示例。
在下文中一共展示了IntervalTimer::GetElapsedTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CTFBotMvMEngineerBuildSGDispenser
DETOUR_DECL_MEMBER(ActionResult<CTFBot>, CTFBotMvMEngineerIdle_Update, CTFBot *actor, float dt)
{
SCOPED_INCREMENT(rc_CTFBotMvMEngineerIdle_Update);
TRACE();
static IntervalTimer last_ask;
constexpr float ask_interval = 20.0f;
constexpr float ask_minwait = 3.0f;
if (RandomFloat(0.0f, 1.0f) < (dt / ask_interval)) {
if (last_ask.GetElapsedTime() > ask_minwait) {
last_ask.Start();
switch (RandomInt(0, 2)) {
case 0:
case 1:
actor->SpeakConceptIfAllowed(MP_CONCEPT_PLAYER_TELEPORTERHERE);
break;
case 2:
actor->SpeakConceptIfAllowed(MP_CONCEPT_PLAYER_SENTRYHERE);
break;
}
}
}
auto result = DETOUR_MEMBER_CALL(CTFBotMvMEngineerIdle_Update)(actor, dt);
if (result.transition == ActionTransition::SUSPEND_FOR && result.action != nullptr) {
if (strcmp(result.action->GetName(), "MvMEngineerBuildSentryGun") == 0 && hint_sg != nullptr) {
delete result.action;
result.action = new CTFBotMvMEngineerBuildSGDispenser(hint_sg);
hint_sg = nullptr;
} else if (strcmp(result.action->GetName(), "MvMEngineerBuildTeleportExit") == 0 && hint_te != nullptr) {
delete result.action;
result.action = new CTFBotMvMEngineerBuildTEDispenser(hint_te);
hint_te = nullptr;
}
}
return result;
}