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


C++ CCSPlayer::GetAbsOrigin方法代码示例

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


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

示例1: if

void CC4::PlayArmingBeeps( void )
{
	float flStartTime = m_fArmedTime - WEAPON_C4_ARM_TIME;

	float flProgress = ( gpGlobals->curtime - flStartTime ) / ( WEAPON_C4_ARM_TIME - 0.75 );

	int currentFrame = (int)( (float)iNumArmingAnimFrames * flProgress );

	int i;
	for( i=0;i<NUM_BEEPS;i++ )
	{
		if( currentFrame <= m_iBeepFrames[i] )
		{
			break;
		}
		else if( !m_bPlayedArmingBeeps[i] )
		{
			m_bPlayedArmingBeeps[i] = true;

			CCSPlayer *owner = GetPlayerOwner();
			Vector soundPosition = owner->GetAbsOrigin() + Vector( 0, 0, 5 );
			CPASAttenuationFilter filter( soundPosition );

			filter.RemoveRecipient( owner );

			// remove anyone that is first person spec'ing the planter
			int i;
			CBasePlayer *pPlayer;
			for( i=1;i<=gpGlobals->maxClients;i++ )
			{
				pPlayer = UTIL_PlayerByIndex( i );

				if ( !pPlayer )
					continue;

				if( pPlayer->GetObserverMode() == OBS_MODE_IN_EYE && pPlayer->GetObserverTarget() == GetOwner() )
				{
					filter.RemoveRecipient( pPlayer );
				}
			}

			EmitSound(filter, entindex(), "c4.click");
			
			break;
		}
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:47,代码来源:weapon_c4.cpp

示例2: if


//.........这里部分代码省略.........
			return;
		}
		else
		{
			if( gpGlobals->curtime >= m_fArmedTime ) //the c4 is ready to be armed
			{
				//check to make sure the player is still in the bomb target area
				PlaceBomb = true;
			}
			else if( ( gpGlobals->curtime >= (m_fArmedTime - 0.75) ) && ( !m_bBombPlacedAnimation ) )
			{
				//call the c4 Placement animation 
				m_bBombPlacedAnimation = true;
				//SendWeaponAnim( C4_DROP, UseDecrement() ? 1: 0 );
				
#if !defined( CLIENT_DLL )
				// player "place" animation
				//pPlayer->SetAnimation( PLAYER_HOLDBOMB );
#endif
			}
		}
	}

	if ( PlaceBomb && m_bStartedArming )
	{
		m_bStartedArming = false;
		m_fArmedTime = 0;
		
		if( pPlayer->m_bInBombZone )
		{
#if !defined( CLIENT_DLL )
			//Broadcast("BOMBPL");

			CPlantedC4::ShootSatchelCharge( pPlayer, pPlayer->GetAbsOrigin(), QAngle(0,0,0) );

			// send director message, that something important happened here
			/*
			MESSAGE_BEGIN( MSG_SPEC, SVC_DIRECTOR );
				WRITE_BYTE ( 9 );	// command length in bytes
				WRITE_BYTE ( DRC_CMD_EVENT ); // bomb placed
				WRITE_SHORT( ENTINDEX(pPlayer->edict()) );
				WRITE_SHORT( 0 );
				WRITE_LONG( 11 | DRC_FLAG_FACEPLAYER );   // eventflags (priority and flags)
			MESSAGE_END();
			*/

			// tell the Ts the bomb has been planted (on radar)
			CTeam *pTeam = GetGlobalTeam( TEAM_TERRORIST );
			for ( int iPlayer=0; iPlayer < pTeam->GetNumPlayers(); iPlayer++ )
			{
				CBasePlayer *pTempPlayer = pTeam->GetPlayer( iPlayer );
				
				if ( pTempPlayer->m_lifeState != LIFE_DEAD )
				{
					/*
					MESSAGE_BEGIN( MSG_ONE, gmsgBombDrop, NULL, pTempPlayer->pev );
						WRITE_COORD( pBomb->pev->origin.x );
						WRITE_COORD( pBomb->pev->origin.y );
						WRITE_COORD( pBomb->pev->origin.z );
						WRITE_BYTE( 1 ); // bomb was planted
					MESSAGE_END();
					*/
				}			
			}

			UTIL_ClientPrintAll( HUD_PRINTCENTER,"#Bomb_Planted" );
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:67,代码来源:weapon_c4.cpp

示例3: filter

	// For CTs to defuse the c4
	void CPlantedC4::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
	{
		//Can't defuse if its already defused or if it has blown up
		if( !m_bBombTicking )
		{
			SetUse( NULL );
			return;
		}

		CCSPlayer *player = dynamic_cast< CCSPlayer* >( pActivator );

		if ( !player || player->GetTeamNumber() != TEAM_CT )
		 	return;

		if ( m_bStartDefuse )
		{
			if ( player != m_pBombDefuser )
			{
				if ( player->m_iNextTimeCheck < gpGlobals->curtime )
				{
					ClientPrint( player, HUD_PRINTCENTER, "#Bomb_Already_Being_Defused" );
					player->m_iNextTimeCheck = gpGlobals->curtime + 1;
				}
				return;
			}

			m_flNextDefuse = gpGlobals->curtime + 0.5;
		}
		else
		{
			// freeze the player in place while defusing
			player->SetMaxSpeed( 1 );

			IGameEvent * event = gameeventmanager->CreateEvent("bomb_begindefuse" );
			if( event )
			{
				event->SetInt( "userid", player->GetUserID() );
				if ( player->HasDefuser() )
				{
					event->SetInt( "haskit", 1 );
					// TODO show messages on clients on event 
					ClientPrint( player, HUD_PRINTCENTER, "#Defusing_Bomb_With_Defuse_Kit" );
				}
				else
				{
					event->SetInt( "haskit", 0 );
					// TODO show messages on clients on event 
					ClientPrint( player, HUD_PRINTCENTER, "#Defusing_Bomb_Without_Defuse_Kit" );
				}
				event->SetInt( "priority", 8 );
                gameeventmanager->FireEvent( event );
			}

			Vector soundPosition = player->GetAbsOrigin() + Vector( 0, 0, 5 );
			CPASAttenuationFilter filter( soundPosition );

			EmitSound( filter, entindex(), "c4.disarmstart" );

			m_flDefuseLength = player->HasDefuser() ? 5 : 10;


			m_flNextDefuse = gpGlobals->curtime + 0.5;
			m_pBombDefuser = player;
			m_bStartDefuse = TRUE;
			player->m_bIsDefusing = true;
			
			m_flDefuseCountDown = gpGlobals->curtime + m_flDefuseLength;

			//start the progress bar
			player->SetProgressBarTime( m_flDefuseLength );
		}
	}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:73,代码来源:weapon_c4.cpp


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