本文整理汇总了C++中CSprite::SetNextThink方法的典型用法代码示例。如果您正苦于以下问题:C++ CSprite::SetNextThink方法的具体用法?C++ CSprite::SetNextThink怎么用?C++ CSprite::SetNextThink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSprite
的用法示例。
在下文中一共展示了CSprite::SetNextThink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Think
void CStomp::Think( void )
{
trace_t tr;
SetNextThink( gpGlobals->curtime + 0.1 );
// Do damage for this frame
Vector vecStart = GetAbsOrigin();
vecStart.z += 30;
Vector vecEnd = vecStart + (m_vecMoveDir * m_flSpeed * gpGlobals->frametime);
UTIL_TraceHull( vecStart, vecEnd, Vector(-32, -32, -32), Vector(32, 32, 32), MASK_SOLID, m_pOwner, COLLISION_GROUP_NONE, &tr );
// NDebugOverlay::Line( vecStart, vecEnd, 0, 255, 0, false, 10.0f );
if ( tr.m_pEnt )
{
CBaseEntity *pEntity = tr.m_pEnt;
CTakeDamageInfo info( this, this, 50, DMG_SONIC );
CalculateMeleeDamageForce( &info, m_vecMoveDir, tr.endpos );
pEntity->TakeDamage( info );
}
// Accelerate the effect
m_flSpeed += (gpGlobals->frametime) * m_uiFramerate;
m_uiFramerate += (gpGlobals->frametime) * 2000;
// Move and spawn trails
while ( gpGlobals->curtime - m_flDmgTime > STOMP_INTERVAL )
{
SetAbsOrigin( GetAbsOrigin() + m_vecMoveDir * m_flSpeed * STOMP_INTERVAL );
for ( int i = 0; i < 2; i++ )
{
CSprite *pSprite = CSprite::SpriteCreate( GARG_STOMP_SPRITE_NAME, GetAbsOrigin(), TRUE );
if ( pSprite )
{
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() - Vector(0,0,500), MASK_SOLID, this, COLLISION_GROUP_NONE, &tr );
pSprite->SetAbsOrigin( tr.endpos );
// pSprite->pev->velocity = Vector(RandomFloat(-200,200),RandomFloat(-200,200),175);
pSprite->SetNextThink( gpGlobals->curtime + 0.3 );
pSprite->SetThink( &CSprite::SUB_Remove );
pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxFadeFast );
}
g_pEffects->EnergySplash( tr.endpos, tr.plane.normal );
}
m_flDmgTime += STOMP_INTERVAL;
// Scale has the "life" of this effect
m_flScale -= STOMP_INTERVAL * m_flSpeed;
if ( m_flScale <= 0 )
{
// Life has run out
UTIL_Remove(this);
// STOP_SOUND( edict(), CHAN_BODY, GARG_STOMP_BUZZ_SOUND );
CPASAttenuationFilter filter( this );
StopSound( entindex(), CHAN_STATIC, GARG_STOMP_BUZZ_SOUND );
}
}
}
示例2: RemoveGrenade
void CTFWeaponBaseGrenadeProj::RemoveGrenade( bool bBlinkOut )
{
// Kill it
SetThink( &BaseClass::SUB_Remove );
SetNextThink( gpGlobals->curtime );
SetTouch( NULL );
AddEffects( EF_NODRAW );
if ( bBlinkOut )
{
// Sprite flash
CSprite *pGlowSprite = CSprite::SpriteCreate( NOGRENADE_SPRITE, GetAbsOrigin(), false );
if ( pGlowSprite )
{
pGlowSprite->SetTransparency( kRenderGlow, 255, 255, 255, 255, kRenderFxFadeFast );
pGlowSprite->SetThink( &CSprite::SUB_Remove );
pGlowSprite->SetNextThink( gpGlobals->curtime + 1.0 );
}
}
}