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


C++ IPlayerInfo::GetLastUserCommand方法代码示例

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


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

示例1: Bot_RunMimicCommand

bool Bot_RunMimicCommand( CBotCmd& cmd )
{
	if ( bot_mimic.GetInt() <= 0 )
		return false;

	if ( bot_mimic.GetInt() > gpGlobals->maxClients )
		return false;

	IPlayerInfo *playerInfo = playerinfomanager->GetPlayerInfo( engine->PEntityOfEntIndex( bot_mimic.GetInt() ) ); 
	if ( !playerInfo )
		return false;

	cmd = playerInfo->GetLastUserCommand();
	cmd.viewangles[YAW] += bot_mimic_yaw_offset.GetFloat();

	if( bot_crouch.GetInt() )
		cmd.buttons |= IN_DUCK;

	return true;
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:20,代码来源:serverplugin_bot.cpp

示例2: if


//.........这里部分代码省略.........
		m_fSpeed = m_vVelocity.Length();
		m_vLastPos = getOrigin();

		if ( (m_fUpdatePos > 0) && (m_fSpeed > 0) )
		{
			if ( !m_bSentWelcomeMessage )
			{
				m_bSentWelcomeMessage = true;

				giveMessage(CStrings::getString(BOT_WELCOME_MESSAGE));

				giveMessage(CStrings::getString(CWaypoints::getWelcomeMessage()),5.0f);
			}
		}

		m_fUpdatePos = engine->Time() + 1.0f;
	}

	if ( isDebugging() )
	{
		IPlayerInfo *p = playerinfomanager->GetPlayerInfo(m_pPlayer);


		if ( isDebugOn(BOT_DEBUG_SPEED) )
		{
			CBotGlobals::botMessage(m_pPlayer,0,"speed = %0.0f",m_fSpeed);
		}

		if ( isDebugOn(BOT_DEBUG_USERCMD) )
		{

			if ( p )
			{
				CBotCmd cmd = p->GetLastUserCommand();

				CBotGlobals::botMessage(m_pPlayer,0,"Btns = %d, cmd_no = %d, impulse = %d, weapselect = %d, weapsub = %d",cmd.buttons,cmd.command_number,cmd.impulse,cmd.weaponselect,cmd.weaponsubtype);

			}
		}


		if ( (m_pDebugBot!=NULL) && isDebugOn(BOT_DEBUG_HUD) )
		{
			if ( m_fNextPrintDebugInfo < engine->Time() )
			{
				char msg[1024];
				CBot *pBot = CBots::getBotPointer(m_pDebugBot);

				QAngle eyes = p->GetLastUserCommand().viewangles;
				Vector vForward;
				// in fov? Check angle to edict
				AngleVectors(eyes,&vForward);

				vForward = vForward / vForward.Length(); // normalize
				Vector vLeft = (vForward-p->GetAbsOrigin()).Cross(Vector(0,0,1));
				vLeft = vLeft/vLeft.Length();
				
				Vector vDisplay = p->GetAbsOrigin() + vForward*300.0f; 
				vDisplay = vDisplay - vLeft*300.0f;

				// get debug message
				pBot->debugBot(msg);

#ifndef __linux__
				int i = 0; 
				int n = 0;
开发者ID:chrizonix,项目名称:RCBot2,代码行数:67,代码来源:bot_client.cpp


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