本文整理汇总了C++中CEffectData::GetEntity方法的典型用法代码示例。如果您正苦于以下问题:C++ CEffectData::GetEntity方法的具体用法?C++ CEffectData::GetEntity怎么用?C++ CEffectData::GetEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEffectData
的用法示例。
在下文中一共展示了CEffectData::GetEntity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FX_BuildTeslaZap
//-----------------------------------------------------------------------------
// Purpose: Tesla effect
//-----------------------------------------------------------------------------
void FX_BuildTeslaZap( const CEffectData &data )
{
// Build the tesla, only works on entities
C_BaseEntity *pEntity = data.GetEntity();
if ( !pEntity )
return;
Vector vColor( 1, 1, 1 );
BeamInfo_t beamInfo;
beamInfo.m_nType = TE_BEAMTESLA;
beamInfo.m_pStartEnt = pEntity;
beamInfo.m_nStartAttachment = data.m_nAttachmentIndex;
beamInfo.m_pEndEnt = NULL;
beamInfo.m_vecEnd = data.m_vOrigin;
beamInfo.m_pszModelName = "sprites/physbeam.vmt";
beamInfo.m_flHaloScale = 0.0;
beamInfo.m_flLife = 0.3f;
beamInfo.m_flWidth = data.m_flScale;
beamInfo.m_flEndWidth = 1;
beamInfo.m_flFadeLength = 0.3;
beamInfo.m_flAmplitude = 16;
beamInfo.m_flBrightness = 200.0;
beamInfo.m_flSpeed = 0.0;
beamInfo.m_nStartFrame = 0.0;
beamInfo.m_flFrameRate = 1.0;
beamInfo.m_flRed = vColor.x * 255.0;
beamInfo.m_flGreen = vColor.y * 255.0;
beamInfo.m_flBlue = vColor.z * 255.0;
beamInfo.m_nSegments = 20;
beamInfo.m_bRenderable = true;
beamInfo.m_nFlags = 0;
beams->CreateBeamEntPoint( beamInfo );
}
示例2: GetTracerOrigin
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Vector GetTracerOrigin( const CEffectData &data )
{
Vector vecStart = data.m_vStart;
QAngle vecAngles;
int iAttachment = data.m_nAttachmentIndex;;
// Attachment?
if ( data.m_fFlags & TRACER_FLAG_USEATTACHMENT )
{
C_BaseViewModel *pViewModel = NULL;
// If the entity specified is a weapon being carried by this player, use the viewmodel instead
IClientRenderable *pRenderable = data.GetRenderable();
if ( !pRenderable )
return vecStart;
C_BaseEntity *pEnt = data.GetEntity();
FOR_EACH_VALID_SPLITSCREEN_PLAYER( hh )
{
ACTIVE_SPLITSCREEN_PLAYER_GUARD( hh );
C_BaseCombatWeapon *pWpn = ToBaseCombatWeapon( pEnt );
if ( pWpn && pWpn->IsCarriedByLocalPlayer() )
{
C_BasePlayer *player = ToBasePlayer( pWpn->GetOwner() );
if( !player && pWpn->GetOwner() && pWpn->GetOwner()->IsUnit() )
{
player = pWpn->GetOwner()->MyUnitPointer()->GetCommander();
}
pViewModel = player ? player->GetViewModel( 0 ) : NULL;
if ( pViewModel )
{
// Get the viewmodel and use it instead
pRenderable = pViewModel;
break;
}
}
}
// Get the attachment origin
if ( !pRenderable->GetAttachment( iAttachment, vecStart, vecAngles ) )
{
DevMsg( "GetTracerOrigin: Couldn't find attachment %d on model %s\n", iAttachment,
modelinfo->GetModelName( pRenderable->GetModel() ) );
}
}
示例3: GetTracerOrigin
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Vector GetTracerOrigin( const CEffectData &data )
{
Vector vecStart = data.m_vStart;
QAngle vecAngles;
int iAttachment = data.m_nAttachmentIndex;;
// Attachment?
if ( data.m_fFlags & TRACER_FLAG_USEATTACHMENT )
{
C_BaseViewModel *pViewModel = NULL;
// If the entity specified is a weapon being carried by this player, use the viewmodel instead
IClientRenderable *pRenderable = data.GetRenderable();
if ( !pRenderable )
return vecStart;
C_BaseEntity *pEnt = data.GetEntity();
// This check should probably be for all multiplayer games, investigate later
#if defined( HL2MP ) || defined( TF_CLIENT_DLL ) || defined( TF_CLASSIC_CLIENT )
if ( pEnt && pEnt->IsDormant() )
return vecStart;
#endif
C_BaseCombatWeapon *pWpn = dynamic_cast<C_BaseCombatWeapon *>( pEnt );
if ( pWpn && pWpn->ShouldDrawUsingViewModel() )
{
C_BasePlayer *player = ToBasePlayer( pWpn->GetOwner() );
// Use GetRenderedWeaponModel() instead?
pViewModel = player ? player->GetViewModel( 0 ) : NULL;
if ( pViewModel )
{
// Get the viewmodel and use it instead
pRenderable = pViewModel;
}
}
// Get the attachment origin
if ( !pRenderable->GetAttachment( iAttachment, vecStart, vecAngles ) )
{
DevMsg( "GetTracerOrigin: Couldn't find attachment %d on model %s\n", iAttachment,
modelinfo->GetModelName( pRenderable->GetModel() ) );
}
}
return vecStart;
}
示例4: ParticleTracerCallback
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void ParticleTracerCallback( const CEffectData &data )
{
C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
if ( !player )
return;
// Grab the data
Vector vecStart = GetTracerOrigin( data );
Vector vecEnd = data.m_vOrigin;
// Adjust view model tracers
C_BaseEntity *pEntity = data.GetEntity();
if ( data.entindex() && data.entindex() == player->index )
{
QAngle vangles;
Vector vforward, vright, vup;
engine->GetViewAngles( vangles );
AngleVectors( vangles, &vforward, &vright, &vup );
VectorMA( data.m_vStart, 4, vright, vecStart );
vecStart[2] -= 0.5f;
}
// Create the particle effect
QAngle vecAngles;
Vector vecToEnd = vecEnd - vecStart;
VectorNormalize(vecToEnd);
VectorAngles( vecToEnd, vecAngles );
DispatchParticleEffect( data.m_nHitBox, vecStart, vecEnd, vecAngles, pEntity );
if ( data.m_fFlags & TRACER_FLAG_WHIZ )
{
FX_TracerSound( vecStart, vecEnd, TRACER_TYPE_DEFAULT );
}
}