本文整理汇总了C++中CAI_BaseNPC::GetCurSchedule方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_BaseNPC::GetCurSchedule方法的具体用法?C++ CAI_BaseNPC::GetCurSchedule怎么用?C++ CAI_BaseNPC::GetCurSchedule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_BaseNPC
的用法示例。
在下文中一共展示了CAI_BaseNPC::GetCurSchedule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PhysicsPyDispatchThink
//-----------------------------------------------------------------------------
// Purpose: Called when it's time for a physically moved objects (plats, doors, etc)
// to run it's game code.
// All other entity thinking is done during worldspawn's think
//-----------------------------------------------------------------------------
void C_BaseEntity::PhysicsPyDispatchThink( bp::object thinkFunc )
{
float thinkLimit = think_limit.GetFloat();
float startTime = 0.0;
/*
// This doesn't apply on the client, really
if ( IsDormant() )
{
Warning( "Dormant entity %s is thinking!!\n", GetClassname() );
Assert(0);
}
*/
if ( thinkLimit )
{
startTime = Plat_FloatTime();
}
if ( thinkFunc.ptr() != Py_None )
{
try {
thinkFunc();
} catch(boost::python::error_already_set &) {
PyErr_Print();
}
}
if ( thinkLimit )
{
// calculate running time of the AI in milliseconds
float time = ( Plat_FloatTime() - startTime ) * 1000.0f;
if ( time > thinkLimit )
{
#if 0
// If its an NPC print out the shedule/task that took so long
CAI_BaseNPC *pNPC = MyNPCPointer();
if (pNPC && pNPC->GetCurSchedule())
{
pNPC->ReportOverThinkLimit( time );
}
else
#endif
{
Msg( "CLIENT: %s(%s) thinking for %.02f ms!!!\n", GetClassname(), typeid(this).raw_name(), time );
}
}
}
}
示例2: PhysicsDispatchThink
//-----------------------------------------------------------------------------
// Purpose: Called when it's time for a physically moved objects (plats, doors, etc)
// to run it's game code.
// All other entity thinking is done during worldspawn's think
//-----------------------------------------------------------------------------
void C_BaseEntity::PhysicsDispatchThink( BASEPTR thinkFunc )
{
float thinkLimit = think_limit.GetFloat();
float startTime = 0.0;
/*
// This doesn't apply on the client, really
if ( IsDormant() )
{
Warning( "Dormant entity %s is thinking!!\n", GetClassname() );
Assert(0);
}
*/
if ( thinkLimit )
{
startTime = Plat_FloatTime();
}
if ( thinkFunc )
{
(this->*thinkFunc)();
}
if ( thinkLimit )
{
// calculate running time of the AI in milliseconds
float time = ( Plat_FloatTime() - startTime ) * 1000.0f;
if ( time > thinkLimit )
{
#if 0
// If its an NPC print out the shedule/task that took so long
CAI_BaseNPC *pNPC = MyNPCPointer();
if (pNPC && pNPC->GetCurSchedule())
{
pNPC->ReportOverThinkLimit( time );
}
else
#endif
{
#ifdef WIN32
Msg( "CLIENT: %s(%s) thinking for %.02f ms!!!\n", GetClassname(), typeid(this).raw_name(), time );
#else
Msg( "CLIENT: %s(%s) thinking for %.02f ms!!!\n", GetClassname(), typeid(this).name(), time );
#endif
}
}
}
}