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


C++ C_TFPlayer::EmitSound方法代码示例

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


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

示例1: SendDestroyMessage

bool CHudMenuEngyBuild::SendDestroyMessage( int iSlot )
{
	C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();

	if ( !pLocalPlayer )
		return false;

	bool bSuccess = false;

	int iBuilding = GetBuildingIDFromSlot( iSlot );

	C_BaseObject *pObj = pLocalPlayer->GetObjectOfType( iBuilding );

	if ( pObj != NULL )
	{
		char szCmd[128];
		Q_snprintf( szCmd, sizeof(szCmd), "destroy %d", iBuilding );
		engine->ClientCmd( szCmd );
		bSuccess = true; 
	}
	else
	{
		pLocalPlayer->EmitSound( "Player.DenyWeaponSelection" );
	}

	return bSuccess;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:27,代码来源:tf_hud_menu_engy_build.cpp

示例2: OnTick

void CHudBuildingStatusContainer::OnTick( void )
{
	if ( m_AlertLevel >= BUILDING_HUD_ALERT_VERY_LOW_AMMO &&
		gpGlobals->curtime >= m_flNextBeep && 
		m_iNumBeepsToBeep > 0 )
	{
		C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();

		if ( !pLocalPlayer )
			return;

		pLocalPlayer->EmitSound( "Hud.Warning" );
			
		switch( m_AlertLevel )
		{
			case BUILDING_HUD_ALERT_VERY_LOW_AMMO:
			case BUILDING_HUD_ALERT_VERY_LOW_HEALTH:
				m_flNextBeep = gpGlobals->curtime + 2.0f;
				m_iNumBeepsToBeep--;
				break;

			case BUILDING_HUD_ALERT_SAPPER:
				m_flNextBeep = gpGlobals->curtime + 1.0f;
				// don't decrement beeps, we want them to go on forever
				break;
		}
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:28,代码来源:tf_hud_building_status.cpp

示例3: SendBuildMessage

void CHudMenuEngyBuild::SendBuildMessage( int iSlot )
{
	C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();

	if ( !pLocalPlayer )
		return;

	int iBuilding = GetBuildingIDFromSlot( iSlot );

	C_BaseObject *pObj = pLocalPlayer->GetObjectOfType( iBuilding );
	int iCost = GetObjectInfo( iBuilding )->m_Cost;

	if ( pObj == NULL && pLocalPlayer->GetAmmoCount( TF_AMMO_METAL ) >= iCost )
	{
		char szCmd[128];
		Q_snprintf( szCmd, sizeof(szCmd), "build %d", iBuilding );
		engine->ClientCmd( szCmd );
	}
	else
	{
		pLocalPlayer->EmitSound( "Player.DenyWeaponSelection" );
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:23,代码来源:tf_hud_menu_engy_build.cpp


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