本文整理汇总了C++中CTFPlayer::HasTheFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFPlayer::HasTheFlag方法的具体用法?C++ CTFPlayer::HasTheFlag怎么用?C++ CTFPlayer::HasTheFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTFPlayer
的用法示例。
在下文中一共展示了CTFPlayer::HasTheFlag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Touch
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CFuncRespawnFlagZone::Touch( CBaseEntity *pOther )
{
if (!IsDisabled())
{
CTFPlayer *pPlayer = ToTFPlayer(pOther);
if ( pPlayer && pPlayer->HasTheFlag() )
{
CTFItem *pItem = pPlayer->GetItem();
if (pItem)
{
CCaptureFlag *pFlag = dynamic_cast<CCaptureFlag*>(pItem);
pPlayer->DropFlag();
if (pFlag)
{
pFlag->Reset();
pFlag->ResetMessage();
}
}
else
{
pPlayer->DropFlag();
}
}
}
}
示例2: SecondaryAttack
//-----------------------------------------------------------------------------
// Purpose: Burn charge level to generate invulnerability
//-----------------------------------------------------------------------------
void CWeaponMedigun::SecondaryAttack( void )
{
CTFPlayer *pOwner = ToTFPlayer( GetOwnerEntity() );
if ( !pOwner )
return;
if ( !CanAttack() )
return;
// Ensure they have a full charge and are not already in charge release mode
if ( m_flChargeLevel < 1.0 || m_bChargeRelease )
{
#ifdef CLIENT_DLL
// Deny, flash
if ( !m_bChargeRelease && m_flFlashCharge <= 0 )
{
m_flFlashCharge = 10;
pOwner->EmitSound( "Player.DenyWeaponSelection" );
}
#endif
return;
}
if ( pOwner->HasTheFlag() )
{
#ifdef GAME_DLL
CSingleUserRecipientFilter filter( pOwner );
TFGameRules()->SendHudNotification( filter, HUD_NOTIFY_NO_INVULN_WITH_FLAG );
#endif
pOwner->EmitSound( "Player.DenyWeaponSelection" );
return;
}
// Start super charge
m_bChargeRelease = true;
m_flReleaseStartedAt = 0;//gpGlobals->curtime;
#ifdef GAME_DLL
CTF_GameStats.Event_PlayerInvulnerable( pOwner );
pOwner->m_Shared.RecalculateChargeEffects();
pOwner->SpeakConceptIfAllowed( MP_CONCEPT_MEDIC_CHARGEDEPLOYED );
if ( m_hHealingTarget && m_hHealingTarget->IsPlayer() )
{
CTFPlayer *pTFPlayer = ToTFPlayer( m_hHealingTarget );
pTFPlayer->m_Shared.RecalculateChargeEffects();
pTFPlayer->SpeakConceptIfAllowed( MP_CONCEPT_HEALTARGET_CHARGEDEPLOYED );
}
IGameEvent * event = gameeventmanager->CreateEvent( "player_chargedeployed" );
if ( event )
{
event->SetInt( "userid", pOwner->GetUserID() );
gameeventmanager->FireEvent( event, true ); // don't send to clients
}
#endif
}
示例3: TeleporterTouch
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void CObjectTeleporter::TeleporterTouch( CBaseEntity *pOther )
{
if ( IsDisabled() )
{
return;
}
// if it's not a player, ignore
if ( !pOther->IsPlayer() )
return;
CTFPlayer *pPlayer = ToTFPlayer( pOther );
CTFPlayer *pBuilder = GetBuilder();
Assert( pBuilder );
if ( !pBuilder )
{
return;
}
// if its not a teammate of the builder, notify the builder
if ( pBuilder->GetTeamNumber() != pOther->GetTeamNumber() )
{
// Don't teleport enemies
return;
}
// is this an entrance and do we have an exit?
if ( GetType() == OBJ_TELEPORTER_ENTRANCE )
{
if ( ( m_iState == TELEPORTER_STATE_READY ) )
{
// are we able to teleport?
if ( pPlayer->HasTheFlag() )
{
// If they have the flag, print a warning that you can't tele with the flag
CSingleUserRecipientFilter filter( pPlayer );
TFGameRules()->SendHudNotification( filter, HUD_NOTIFY_NO_TELE_WITH_FLAG );
return;
}
// get the velocity of the player touching the teleporter
if ( pPlayer->GetAbsVelocity().Length() < 5.0 )
{
CObjectTeleporter *pDest = GetMatchingTeleporter();
if ( pDest )
{
TeleporterSend( pPlayer );
}
}
}
}
}
示例4: RespawnRoomTouch
//-----------------------------------------------------------------------------
// Purpose:
// Input : pOther - The thing that touched us.
//-----------------------------------------------------------------------------
void CFuncRespawnRoom::RespawnRoomTouch(CBaseEntity *pOther)
{
if ( PassesTriggerFilters(pOther) )
{
if ( pOther->IsPlayer() && InSameTeam( pOther ) )
{
// Players carrying the flag drop it if they try to run into a respawn room
CTFPlayer *pPlayer = ToTFPlayer(pOther);
if ( pPlayer->HasTheFlag() && !m_bAllowFlag )
{
pPlayer->DropFlag();
}
}
}
}
示例5: TeleporterTouch
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void CObjectTeleporter::TeleporterTouch( CBaseEntity *pOther )
{
if ( IsDisabled() )
{
return;
}
// if it's not a player, ignore
if ( !pOther->IsPlayer() )
return;
CTFPlayer *pPlayer = ToTFPlayer( pOther );
int bTwoWayTeleporter = 0;
CALL_ATTRIB_HOOK_INT_ON_OTHER( pPlayer, bTwoWayTeleporter, bidirectional_teleport );
// is this an entrance and do we have an exit?
if ( GetObjectMode() == TELEPORTER_TYPE_ENTRANCE || bTwoWayTeleporter > 0 )
{
if ( ( m_iState == TELEPORTER_STATE_READY ) )
{
// are we able to teleport?
if ( !PlayerCanBeTeleported( pPlayer ) )
{
if ( pPlayer->HasTheFlag() )
{
// If they have the flag, print a warning that you can't tele with the flag
CSingleUserRecipientFilter filter( pPlayer );
TFGameRules()->SendHudNotification( filter, HUD_NOTIFY_NO_TELE_WITH_FLAG );
}
return;
}
// get the velocity of the player touching the teleporter
if ( pPlayer->GetAbsVelocity().Length() < 5.0 )
{
CObjectTeleporter *pDest = GetMatchingTeleporter();
if ( pDest )
{
TeleporterSend( pPlayer );
}
}
}
}
}