本文整理汇总了C++中EHANDLE::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ EHANDLE::Get方法的具体用法?C++ EHANDLE::Get怎么用?C++ EHANDLE::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EHANDLE
的用法示例。
在下文中一共展示了EHANDLE::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MeasureThink
//-----------------------------------------------------------------------------
// Apply movement
//-----------------------------------------------------------------------------
void CLogicMeasureMovement::MeasureThink( )
{
// FIXME: This is a hack to make measuring !player simpler. The player isn't
// created at Activate time, so m_hMeasureTarget may be NULL because of that.
if ( !m_hMeasureTarget.Get() && !Q_strnicmp( STRING(m_strMeasureTarget), "!player", 8 ) )
{
SetMeasureTarget( STRING(m_strMeasureTarget) );
}
// Make sure all entities are valid
if ( m_hMeasureTarget.Get() && m_hMeasureReference.Get() && m_hTarget.Get() && m_hTargetReference.Get() )
{
matrix3x4_t matRefToMeasure, matWorldToMeasure;
switch( m_nMeasureType )
{
case MEASURE_POSITION:
MatrixInvert( m_hMeasureTarget->EntityToWorldTransform(), matWorldToMeasure );
break;
case MEASURE_EYE_POSITION:
AngleIMatrix( m_hMeasureTarget->EyeAngles(), m_hMeasureTarget->EyePosition(), matWorldToMeasure );
break;
// FIXME: Could add attachment point measurement here easily
}
ConcatTransforms( matWorldToMeasure, m_hMeasureReference->EntityToWorldTransform(), matRefToMeasure );
// Apply the scale factor
if ( ( m_flScale != 0.0f ) && ( m_flScale != 1.0f ) )
{
Vector vecTranslation;
MatrixGetColumn( matRefToMeasure, 3, vecTranslation );
vecTranslation /= m_flScale;
MatrixSetColumn( vecTranslation, 3, matRefToMeasure );
}
// Now apply the new matrix to the new reference point
matrix3x4_t matMeasureToRef, matNewTargetToWorld;
MatrixInvert( matRefToMeasure, matMeasureToRef );
ConcatTransforms( m_hTargetReference->EntityToWorldTransform(), matMeasureToRef, matNewTargetToWorld );
Vector vecNewOrigin;
QAngle vecNewAngles;
MatrixAngles( matNewTargetToWorld, vecNewAngles, vecNewOrigin );
m_hTarget->SetAbsOrigin( vecNewOrigin );
m_hTarget->SetAbsAngles( vecNewAngles );
}
SetNextThink( gpGlobals->curtime + TICK_INTERVAL );
}
示例2: UpdateOnRemove
void CPhysicsEntitySolver::UpdateOnRemove()
{
//physenv->DestroyMotionController( m_pController );
//m_pController = NULL;
CBaseEntity *pEntity = m_hMovingEntity.Get();
CBaseEntity *pPhysics = m_hPhysicsBlocker.Get();
if ( pEntity && pPhysics )
{
PhysEnableEntityCollisions( pEntity, pPhysics );
}
if ( pPhysics )
{
pPhysics->SetCollisionGroup( m_savedCollisionGroup );
}
BaseClass::UpdateOnRemove();
}
示例3: FiringThink
//-----------------------------------------------------------------------------
// Purpose: Charge up, deal damage along our facing direction.
//-----------------------------------------------------------------------------
void CNPC_RocketTurret::FiringThink( void )
{
//Allow descended classes a chance to do something before the think function
if ( PreThink() )
return;
SetNextThink( gpGlobals->curtime + ROCKET_TURRET_THINK_RATE );
CRocket_Turret_Projectile* pRocket = dynamic_cast<CRocket_Turret_Projectile*>(m_hCurRocket.Get());
if ( pRocket )
{
// If this rocket has been out too long, detonate it and launch a new one
if ( (gpGlobals->curtime - m_flTimeLastFired) > ROCKET_PROJECTILE_DEFAULT_LIFE )
{
pRocket->ShotDown();
m_flTimeLastFired = gpGlobals->curtime;
SetThink( &CNPC_RocketTurret::FollowThink );
}
}
else
{
// Set Locked sprite
UpdateSkin( ROCKET_SKIN_IDLE );
// Rocket dead, or never created. Revert to follow think
m_flTimeLastFired = gpGlobals->curtime;
SetThink( &CNPC_RocketTurret::FollowThink );
}
}
示例4: Drop
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponBugBait::Drop( const Vector &vecVelocity )
{
BaseClass::Drop( vecVelocity );
// On touch, stick & stop moving. Increase our thinktime a bit so we don't stomp the touch for a bit
SetNextThink( gpGlobals->curtime + 3.0 );
SetTouch( &CWeaponBugBait::BugbaitStickyTouch );
m_hSporeTrail = SporeExplosion::CreateSporeExplosion();
if ( m_hSporeTrail )
{
SporeExplosion *pSporeExplosion = (SporeExplosion *)m_hSporeTrail.Get();
QAngle angles;
VectorAngles( Vector(0,0,1), angles );
pSporeExplosion->SetAbsAngles( angles );
pSporeExplosion->SetAbsOrigin( GetAbsOrigin() );
pSporeExplosion->SetParent( this );
pSporeExplosion->m_flSpawnRate = 16.0f;
pSporeExplosion->m_flParticleLifetime = 0.5f;
pSporeExplosion->SetRenderColor( 0, (int)0.5f, (int)0.25f, (int)0.15f );
pSporeExplosion->m_flStartSize = 32;
pSporeExplosion->m_flEndSize = 48;
pSporeExplosion->m_flSpawnRadius = 4;
pSporeExplosion->SetLifetime( 9999 );
}
}
示例5: NotifyLauncherOnDeath
void CRocket_Turret_Projectile::NotifyLauncherOnDeath( void )
{
CNPC_RocketTurret* pLauncher = (CNPC_RocketTurret*)m_hLauncher.Get();
if ( pLauncher )
{
pLauncher->RocketDied();
}
}
示例6:
CSoundPatch *CSoundControllerImp::SoundCreate( IRecipientFilter& filter, int nEntIndex, int channel,
const char *pSoundName, soundlevel_t soundlevel )
{
CSoundPatch *pSound = new CSoundPatch;
EHANDLE hEnt = (nEntIndex != -1) ? g_pEntityList->GetNetworkableHandle( nEntIndex ) : NULL;
pSound->Init( &filter, hEnt.Get(), channel, pSoundName, soundlevel );
return pSound;
}
示例7: Think
void CLogicMirrorMovement::Think()
{
// Attempt to get the player's handle because it didn't exist at Activate time
if ( !m_hMirrorTarget.Get() )
{
// If we will never find a target, we don't have a use... shutdown
if ( m_strMirrorTarget == NULL_STRING )
SetNextThink ( NULL );
//BUGBUG: If m_strSetMirrorTarget doesn't exist in ent list, we get per-think searches with no results ever...
SetMirrorTarget ( STRING(m_strMirrorTarget) );
}
// Make sure all entities are valid
if ( m_hMirrorTarget.Get() && m_hMovementTarget.Get() && m_hRemoteTarget.Get() && m_hMirrorRelative.Get() )
{
// Get our two portal's world transforms transforms
VMatrix matPortal1ToWorldInv, matPortal2ToWorld;
MatrixInverseGeneral( m_hMirrorRelative->EntityToWorldTransform(), matPortal1ToWorldInv );
matPortal2ToWorld = m_hRemoteTarget->EntityToWorldTransform();
VMatrix matTransformToRemotePortal = matPortal1ToWorldInv * matPortal2ToWorld;
// Get our scene camera's current orientation
Vector ptCameraPosition, vCameraLook, vCameraRight, vCameraUp;
ptCameraPosition = m_hMirrorTarget->EyePosition();
m_hMirrorTarget->GetVectors ( &vCameraLook, &vCameraRight, &vCameraUp );
// map this position and orientation to the remote portal, mirrored (invert the result)
Vector ptNewPosition, vNewLook;
ptNewPosition = matPortal1ToWorldInv * ptCameraPosition;
ptNewPosition = matPortal2ToWorld*( Vector( -ptNewPosition.x, -ptNewPosition.y, ptNewPosition.z ) );
vNewLook = matPortal1ToWorldInv.ApplyRotation( vCameraLook );
vNewLook = matPortal2ToWorld.ApplyRotation( Vector( -vNewLook.x, -vNewLook.y, vNewLook.z) );
// Set the point camera to the new location/orientation
QAngle qNewAngles;
VectorAngles( vNewLook, qNewAngles );
m_hMovementTarget->Teleport( &ptNewPosition, &qNewAngles, NULL );
}
SetNextThink( gpGlobals->curtime + TICK_INTERVAL );
}
示例8: CheckTouching
bool CPhysicsNPCSolver::CheckTouching()
{
CAI_BaseNPC *pNPC = m_hNPC.Get();
if ( !pNPC )
return false;
CBaseEntity *pPhysicsEnt = m_hEntity.Get();
if ( !pPhysicsEnt )
return false;
IPhysicsObject *pPhysics = pPhysicsEnt->VPhysicsGetObject();
IPhysicsObject *pNPCPhysics = pNPC->VPhysicsGetObject();
if ( !pNPCPhysics || !pPhysics )
return false;
IPhysicsFrictionSnapshot *pSnapshot = pPhysics->CreateFrictionSnapshot();
bool found = false;
bool penetrate = false;
while ( pSnapshot->IsValid() )
{
IPhysicsObject *pOther = pSnapshot->GetObject(1);
if ( pOther == pNPCPhysics )
{
found = true;
if ( IsContactOnNPCHead(pSnapshot, pPhysics, pNPC ) )
{
penetrate = true;
pSnapshot->MarkContactForDelete();
}
break;
}
pSnapshot->NextFrictionData();
}
pSnapshot->DeleteAllMarkedContacts( true );
pPhysics->DestroyFrictionSnapshot( pSnapshot );
// if the object is penetrating something, check to see if it's intersecting this NPC
// if so, go ahead and switch over to penetration solver mode
if ( !penetrate && (pPhysics->GetGameFlags() & FVPHYSICS_PENETRATING) )
{
penetrate = IsIntersecting();
}
if ( penetrate )
{
pPhysicsEnt->ClearNavIgnore();
BecomePenetrationSolver();
}
return found;
}
示例9:
CGameGibManager *GetGibManager( void )
{
#ifndef HL2_EPISODIC
return NULL;
#endif
if ( g_hGameGibManager == NULL )
{
g_hGameGibManager = (CGameGibManager *)gEntList.FindEntityByClassname( NULL, "game_gib_manager" );
}
return (CGameGibManager *)g_hGameGibManager.Get();
}
示例10: AddParticle
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_EntityParticleTrail::AddParticle( float flInitialDeltaTime, const Vector &vecMins, const Vector &vecMaxs, const matrix3x4_t &boxToWorld )
{
// Select a random point somewhere in the hitboxes of the entity.
Vector vecLocalPosition, vecWorldPosition;
vecLocalPosition.x = Lerp( random->RandomFloat( 0.0f, 1.0f ), vecMins.x, vecMaxs.x );
vecLocalPosition.y = Lerp( random->RandomFloat( 0.0f, 1.0f ), vecMins.y, vecMaxs.y );
vecLocalPosition.z = Lerp( random->RandomFloat( 0.0f, 1.0f ), vecMins.z, vecMaxs.z );
VectorTransform( vecLocalPosition, boxToWorld, vecWorldPosition );
// Don't emit the particle unless it's inside the model
if ( m_hConstraintEntity.Get() )
{
Ray_t ray;
trace_t tr;
ray.Init( vecWorldPosition, vecWorldPosition );
enginetrace->ClipRayToEntity( ray, MASK_ALL, m_hConstraintEntity, &tr );
if ( !tr.startsolid )
return;
}
// Make a new particle
SimpleParticle *pParticle = (SimpleParticle *)m_ParticleEffect.AddParticle( sizeof(SimpleParticle), m_hMaterial );
if ( pParticle == NULL )
return;
pParticle->m_Pos = vecWorldPosition;
pParticle->m_flRoll = Helper_RandomInt( 0, 360 );
pParticle->m_flRollDelta = Helper_RandomFloat( -2.0f, 2.0f );
pParticle->m_flLifetime = flInitialDeltaTime;
pParticle->m_flDieTime = m_Info.m_flLifetime;
pParticle->m_uchColor[0] = 64;
pParticle->m_uchColor[1] = 140;
pParticle->m_uchColor[2] = 225;
pParticle->m_uchStartAlpha = Helper_RandomInt( 64, 64 );
pParticle->m_uchEndAlpha = 0;
pParticle->m_uchStartSize = m_Info.m_flStartSize;
pParticle->m_uchEndSize = m_Info.m_flEndSize;
pParticle->m_vecVelocity = vec3_origin;
VectorMA( pParticle->m_Pos, flInitialDeltaTime, pParticle->m_vecVelocity, pParticle->m_Pos );
}
示例11: BecomePenetrationSolver
void CPhysicsNPCSolver::BecomePenetrationSolver()
{
CBaseEntity *pEntity = m_hEntity.Get();
if ( pEntity )
{
m_allowIntersection = true;
IPhysicsObject *pList[VPHYSICS_MAX_OBJECT_LIST_COUNT];
int listCount = pEntity->VPhysicsGetObjectList( pList, ARRAYSIZE(pList) );
PhysDisableEntityCollisions( m_hNPC, pEntity );
m_pController = physenv->CreateMotionController( this );
for ( int i = 0; i < listCount; i++ )
{
m_pController->AttachObject( pList[i], false );
pList[i]->Wake();
}
m_pController->SetPriority( IPhysicsMotionController::HIGH_PRIORITY );
}
}
示例12: PostDataUpdate
virtual void PostDataUpdate( DataUpdateType_t updateType )
{
VPROF( "C_TEPlayerAnimEvent::PostDataUpdate" );
// Create the effect.
if ( m_iPlayerIndex == MAX_PLAYERS+1 )
return;
EHANDLE hPlayer = cl_entitylist->GetNetworkableHandle( m_iPlayerIndex );
if ( !hPlayer )
return;
C_CFPlayer *pPlayer = dynamic_cast< C_CFPlayer* >( hPlayer.Get() );
if ( pPlayer && !pPlayer->IsDormant() )
{
pPlayer->DoAnimationEvent( (PlayerAnimEvent_t)m_iEvent.Get(), m_nData, m_bSecondary );
}
}
示例13: IsIntersecting
bool CPhysicsNPCSolver::IsIntersecting()
{
CAI_BaseNPC *pNPC = m_hNPC.Get();
CBaseEntity *pPhysics = m_hEntity.Get();
if ( pNPC && pPhysics )
{
Ray_t ray;
// bloated bounds to force slight separation
Vector mins = pNPC->WorldAlignMins() - Vector(1,1,1);
Vector maxs = pNPC->WorldAlignMaxs() + Vector(1,1,1);
ray.Init( pNPC->GetAbsOrigin(), pNPC->GetAbsOrigin(), mins, maxs );
trace_t tr;
enginetrace->ClipRayToEntity( ray, pNPC->PhysicsSolidMaskForEntity(), pPhysics, &tr );
if ( tr.startsolid )
return true;
}
return false;
}
示例14: OnRestore
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponStriderBuster::OnRestore( void )
{
BaseClass::OnRestore();
// If we have an entity we're attached to, attempt to reconstruct our bone follower setup
if ( m_hConstrainedEntity != NULL )
{
CNPC_Strider *pStrider = dynamic_cast<CNPC_Strider *>(m_hConstrainedEntity.Get());
if ( pStrider != NULL )
{
// Make sure we've done this step or we'll have no controller to attach to
pStrider->InitBoneFollowers();
// Attempt to make a connection to the same bone follower we attached to previously
CBoneFollower *pBoneFollower = pStrider->GetBoneFollowerByIndex( m_nAttachedBoneFollowerIndex );
if ( CreateConstraintToObject( pBoneFollower ) == false )
{
Msg( "Failed to reattach to bone follower %d\n", m_nAttachedBoneFollowerIndex );
}
}
}
}
示例15: MoveTowardsTargetEntity
//---------------------------------------------------------
// Set velocity that will carry me towards a specified entity
// Most often used to move along with the npc_blob that
// is directing me.
//---------------------------------------------------------
void CBlobElement::MoveTowardsTargetEntity( float speed )
{
CBaseEntity *pTarget = m_hTargetEntity.Get();
if( pTarget != NULL )
{
// Try to attack my target's enemy directly if I can.
CBaseEntity *pTargetEnemy = pTarget->GetEnemy();
if( pTargetEnemy != NULL )
{
pTarget = pTargetEnemy;
}
Vector vecDir = pTarget->WorldSpaceCenter() - GetAbsOrigin();
vecDir.NormalizeInPlace();
SetElementVelocity( vecDir * speed, true );
}
else
{
SetElementVelocity( vec3_origin, true );
}
}