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


C++ CTeamControlPointMaster::GetLastOwnershipChangeTime方法代码示例

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


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

示例1: CaptureStart

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTeamControlPoint::CaptureStart( int iCapTeam, int iNumCappingPlayers, int *pCappingPlayers )
{
	int iNumCappers = iNumCappingPlayers;

	float flLastOwnershipChangeTime = -1.f;
	CBaseEntity *pEnt =	gEntList.FindEntityByClassname( NULL, GetControlPointMasterName() );
	while( pEnt )
	{
		CTeamControlPointMaster *pMaster = dynamic_cast<CTeamControlPointMaster *>( pEnt );
		if ( pMaster && pMaster->IsActive() )
		{
			flLastOwnershipChangeTime = pMaster->GetLastOwnershipChangeTime();
		}
		pEnt = gEntList.FindEntityByClassname( pEnt, GetControlPointMasterName() );
	}

	IGameEvent *event = gameeventmanager->CreateEvent( "teamplay_point_startcapture" );
	if ( event )
	{
		event->SetInt( "cp", m_iPointIndex );
		event->SetString( "cpname", STRING( m_iszPrintName ) );
		event->SetInt( "team", m_iTeam );
		event->SetInt( "capteam", iCapTeam );
		event->SetFloat( "captime", gpGlobals->curtime - flLastOwnershipChangeTime );

		// safety check
		if ( iNumCappers > 8 )
		{
			iNumCappers = 8;
		}

		char cappers[9];	// pCappingPlayers should be max length 8
		int i;
		for( i = 0 ; i < iNumCappers ; i++ )
		{
			cappers[i] = (char)pCappingPlayers[i];
		}

		cappers[i] = '\0';

		// pCappingPlayers is a null terminated list of player indices
		event->SetString( "cappers", cappers );
		event->SetInt( "priority", 7 );

		gameeventmanager->FireEvent( event );
	}
}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:50,代码来源:team_control_point.cpp


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