本文整理汇总了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 );
}
}