当前位置: 首页>>代码示例>>C++>>正文


C++ TMonsterAIUtil::CheckMovingCondition方法代码示例

本文整理汇总了C++中TMonsterAIUtil::CheckMovingCondition方法的典型用法代码示例。如果您正苦于以下问题:C++ TMonsterAIUtil::CheckMovingCondition方法的具体用法?C++ TMonsterAIUtil::CheckMovingCondition怎么用?C++ TMonsterAIUtil::CheckMovingCondition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TMonsterAIUtil的用法示例。


在下文中一共展示了TMonsterAIUtil::CheckMovingCondition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MonsterMove

void TMonsterAI::MonsterMove(int iIndex)
{
	LPOBJ lpObj = &gObj[iIndex];

	if ( MONSTER_UTIL.CheckMovingCondition(lpObj) == FALSE )
	{
		lpObj->PathCur = 0;
		lpObj->PathCount = 0;
		lpObj->PathStartEnd = 0;
		memset(lpObj->PathX, 0, sizeof(lpObj->PathX));
		memset(lpObj->PathY, 0, sizeof(lpObj->PathY));
		memset(lpObj->PathDir, 0, sizeof(lpObj->PathY)); //check this out

		return ;
	}

	if ( lpObj->PathCount != 0 )
	{
		DWORD dwMoveTime = 0;
		DWORD dwDelayTime = 0;

		if ( lpObj->DelayLevel != 0 )
			dwDelayTime = 300;
		else
			dwDelayTime = 0;

		lpObj->m_MoveSpeed = 300;
		
		if ( (lpObj->PathDir[lpObj->PathCur] % 2 ) == 0 )
			dwMoveTime = (DWORD)((double)(lpObj->m_MoveSpeed + dwDelayTime) * 1.3);
		else
			dwMoveTime = lpObj->m_MoveSpeed + dwDelayTime;

		if ( (GetTickCount() - lpObj->PathTime) > dwMoveTime )
		{
			if ( lpObj->PathCur < 15 )
			{
				lpObj->X = lpObj->PathX[lpObj->PathCur];
				lpObj->Y = lpObj->PathY[lpObj->PathCur];
				lpObj->Dir = lpObj->PathDir[lpObj->PathCur];
				lpObj->PathTime = GetTickCount();
				lpObj->PathCur++;

				if ( lpObj->PathCur >= lpObj->PathCount )
				{
					lpObj->PathCur = 0;
					lpObj->PathCount = 0;
					lpObj->PathStartEnd = 0;
				}
			}

			CreateFrustrum(lpObj->X, lpObj->Y, iIndex);
		}

		return;

	}

	lpObj->PathCur = 0;
	lpObj->PathCount = 0;
	lpObj->PathStartEnd = 0;
	memset(lpObj->PathX, 0, sizeof(lpObj->PathX));
	memset(lpObj->PathY, 0, sizeof(lpObj->PathY));
	memset(lpObj->PathDir, 0, sizeof(lpObj->PathY)); //check this out
}
开发者ID:kamilj1988,项目名称:Exodus-V1,代码行数:65,代码来源:TMonsterAI.cpp


注:本文中的TMonsterAIUtil::CheckMovingCondition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。