本文整理汇总了C++中CCSPlayer::EyePosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CCSPlayer::EyePosition方法的具体用法?C++ CCSPlayer::EyePosition怎么用?C++ CCSPlayer::EyePosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCSPlayer
的用法示例。
在下文中一共展示了CCSPlayer::EyePosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TripmineAttach
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeapon_SLAM::TripmineAttach( void )
{
CCSPlayer *pOwner = ToCSPlayer( GetOwner() );
if (!pOwner)
{
return;
}
m_bAttachTripmine = false;
Vector vecSrc, vecAiming;
// Take the eye position and direction
vecSrc = pOwner->EyePosition();
QAngle angles = pOwner->GetLocalAngles();
AngleVectors( angles, &vecAiming );
trace_t tr;
UTIL_TraceLine( vecSrc, vecSrc + (vecAiming * 128), MASK_SOLID, pOwner, COLLISION_GROUP_NONE, &tr );
if (tr.fraction < 1.0)
{
CBaseEntity *pEntity = tr.m_pEnt;
if (pEntity && !(pEntity->GetFlags() & FL_CONVEYOR))
{
#ifndef CLIENT_DLL
QAngle angles;
VectorAngles(tr.plane.normal, angles);
angles.x += 90;
CBaseEntity *pEnt = CBaseEntity::Create( "npc_tripmine", tr.endpos + tr.plane.normal * 3, angles, NULL );
CTripmineGrenade *pMine = (CTripmineGrenade *)pEnt;
pMine->m_hOwner = GetOwner();
#endif
pOwner->RemoveAmmo( 1, m_iSecondaryAmmoType );
}
}
}
示例2: CanAttachSLAM
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
bool CWeapon_SLAM::CanAttachSLAM( void )
{
CCSPlayer *pOwner = ToCSPlayer( GetOwner() );
if (!pOwner)
{
return false;
}
Vector vecSrc, vecAiming;
// Take the eye position and direction
vecSrc = pOwner->EyePosition();
QAngle angles = pOwner->GetLocalAngles();
AngleVectors( angles, &vecAiming );
trace_t tr;
Vector vecEnd = vecSrc + (vecAiming * 42);
UTIL_TraceLine( vecSrc, vecEnd, MASK_SOLID, pOwner, COLLISION_GROUP_NONE, &tr );
if (tr.fraction < 1.0)
{
// Don't attach to a living creature
if (tr.m_pEnt)
{
CBaseEntity *pEntity = tr.m_pEnt;
CBaseCombatCharacter *pBCC = ToBaseCombatCharacter( pEntity );
if (pBCC)
{
return false;
}
}
return true;
}
else
{
return false;
}
}
示例3: UpdatePlayerData
//.........这里部分代码省略.........
// engine->Con_NPrintf( i, "Invalid" );
}*/
}
if( !m_foundGoalPositions )
{
// We only need to update these once a map, but we need the client to know about them.
CBaseEntity* ent = NULL;
while ( ( ent = gEntList.FindEntityByClassname( ent, "func_bomb_target" ) ) != NULL )
{
const Vector &pos = ent->WorldSpaceCenter();
CNavArea *area = TheNavMesh->GetNearestNavArea( pos, true );
const char *placeName = (area) ? TheNavMesh->PlaceToName( area->GetPlace() ) : NULL;
if ( placeName == NULL )
{
// The bomb site has no area or place name, so just choose A then B
if ( m_bombsiteCenterA.Get().IsZero() )
{
m_bombsiteCenterA = pos;
}
else
{
m_bombsiteCenterB = pos;
}
}
else
{
// The bomb site has a place name, so choose accordingly
if( FStrEq( placeName, "BombsiteA" ) )
{
m_bombsiteCenterA = pos;
}
else
{
m_bombsiteCenterB = pos;
}
}
m_foundGoalPositions = true;
}
int hostageRescue = 0;
while ( (( ent = gEntList.FindEntityByClassname( ent, "func_hostage_rescue" ) ) != NULL) && (hostageRescue < MAX_HOSTAGE_RESCUES) )
{
const Vector &pos = ent->WorldSpaceCenter();
m_hostageRescueX.Set( hostageRescue, (int) pos.x );
m_hostageRescueY.Set( hostageRescue, (int) pos.y );
m_hostageRescueZ.Set( hostageRescue, (int) pos.z );
hostageRescue++;
m_foundGoalPositions = true;
}
}
bool bombSpotted = false;
if ( c4 )
{
Spotter spotter( c4, m_vecC4, TEAM_CT );
ForEachPlayer( spotter );
if ( spotter.Spotted() )
{
bombSpotted = true;
}
}
for ( int i=0; i < MAX_PLAYERS+1; i++ )
{
CCSPlayer *target = ToCSPlayer( UTIL_PlayerByIndex( i ) );
if ( !target || !target->IsAlive() )
{
m_bPlayerSpotted.Set( i, 0 );
continue;
}
Spotter spotter( target, target->EyePosition(), (target->GetTeamNumber()==TEAM_CT) ? TEAM_TERRORIST : TEAM_CT );
ForEachPlayer( spotter );
if ( spotter.Spotted() )
{
if ( target->HasC4() )
{
bombSpotted = true;
}
m_bPlayerSpotted.Set( i, 1 );
}
else
{
m_bPlayerSpotted.Set( i, 0 );
}
}
if ( bombSpotted )
{
m_bBombSpotted = true;
}
else
{
m_bBombSpotted = false;
}
BaseClass::UpdatePlayerData();
}