本文整理汇总了C++中CNpc::NpcTracing方法的典型用法代码示例。如果您正苦于以下问题:C++ CNpc::NpcTracing方法的具体用法?C++ CNpc::NpcTracing怎么用?C++ CNpc::NpcTracing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNpc
的用法示例。
在下文中一共展示了CNpc::NpcTracing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NpcThreadProc
//////////////////////////////////////////////////////////////////////
// NPC Thread Callback Function
//
UINT NpcThreadProc(LPVOID pParam /* NPC_THREAD_INFO ptr */)
{
NPC_THREAD_INFO* pInfo = (NPC_THREAD_INFO*)pParam;
CNpc* pNpc = NULL;
CIOCPort* pIOCP = NULL;
CPoint pt;
int i = 0;
DWORD dwDiffTime = 0;
DWORD dwSleep = 250;
DWORD dwTickTime = 0;
srand( (unsigned)time( NULL ) );
myrand( 1, 10000 ); myrand( 1, 10000 );
float fTime2 = 0.0f;
float fTime3 = 0.0f;
int duration_damage=0;
if(!pInfo) return 0;
while(!g_bNpcExit)
{
fTime2 = TimeGet();
for(i = 0; i < NPC_NUM; i++)
{
pNpc = pInfo->pNpc[i];
pIOCP = pInfo->pIOCP;
if( !pNpc ) continue;
//if((pNpc->m_tNpcType == NPCTYPE_DOOR || pNpc->m_tNpcType == NPCTYPE_ARTIFACT || pNpc->m_tNpcType == NPCTYPE_PHOENIX_GATE || pNpc->m_tNpcType == NPCTYPE_GATE_LEVER) && !pNpc->m_bFirstLive) continue;
//if( pNpc->m_bFirstLive ) continue;
if( pNpc->m_sNid < 0 ) continue; // 잘못된 몬스터 (임시코드 2002.03.24)
fTime3 = fTime2 - pNpc->m_fDelayTime;
dwTickTime = fTime3 * 1000;
//if(i==0)
//TRACE("thread time = %.2f, %.2f, %.2f, delay=%d, state=%d, nid=%d\n", pNpc->m_fDelayTime, fTime2, fTime3, dwTickTime, pNpc->m_NpcState, pNpc->m_sNid+NPC_BAND);
if(pNpc->m_Delay > (int)dwTickTime && !pNpc->m_bFirstLive && pNpc->m_Delay != 0)
{
if(pNpc->m_Delay < 0) pNpc->m_Delay = 0;
//적발견시... (2002. 04.23수정, 부하줄이기)
if(pNpc->m_NpcState == NPC_STANDING && pNpc->CheckFindEnermy() ) {
if( pNpc->FindEnemy() ) {
pNpc->m_NpcState = NPC_ATTACKING;
pNpc->m_Delay = 0;
}
}
continue;
}
fTime3 = fTime2 - pNpc->m_fHPChangeTime;
dwTickTime = fTime3 * 1000;
if( 10000 < dwTickTime ) { // 10초마다 HP를 회복 시켜준다
pNpc->HpChange(pIOCP);
}
pNpc->DurationMagic_4(pIOCP, fTime2); // 마법 처리...
pNpc->DurationMagic_3(pIOCP, fTime2); // 지속마법..
switch(pNpc->m_NpcState)
{
case NPC_LIVE: // 방금 살아난 경우
pNpc->NpcLive(pIOCP);
break;
case NPC_STANDING: // 하는 일 없이 서있는 경우
pNpc->NpcStanding();
break;
case NPC_MOVING:
pNpc->NpcMoving(pIOCP);
break;
case NPC_ATTACKING:
pNpc->NpcAttacking(pIOCP);
break;
case NPC_TRACING:
pNpc->NpcTracing(pIOCP);
break;
case NPC_FIGHTING:
pNpc->NpcFighting(pIOCP);
break;
case NPC_BACK:
pNpc->NpcBack(pIOCP);
break;
case NPC_STRATEGY:
break;
case NPC_DEAD:
//.........这里部分代码省略.........