本文整理汇总了C++中GetActivity函数的典型用法代码示例。如果您正苦于以下问题:C++ GetActivity函数的具体用法?C++ GetActivity怎么用?C++ GetActivity使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetActivity函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartSatchelDetonate
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeapon_SLAM::StartSatchelDetonate()
{
if ( GetActivity() != ACT_SLAM_DETONATOR_IDLE && GetActivity() != ACT_SLAM_THROW_IDLE )
return;
// -----------------------------------------
// Play detonate animation
// -----------------------------------------
if (m_bNeedReload)
{
SendWeaponAnim(ACT_SLAM_DETONATOR_DETONATE);
}
else if (m_tSlamState == SLAM_SATCHEL_ATTACH)
{
SendWeaponAnim(ACT_SLAM_STICKWALL_DETONATE);
}
else if (m_tSlamState == SLAM_SATCHEL_THROW)
{
SendWeaponAnim(ACT_SLAM_THROW_DETONATE);
}
else
{
return;
}
SatchelDetonate();
// needs a higher delay on all of these, a minimum time really - to elimiate refires.
m_flNextPrimaryAttack = m_flNextSecondaryAttack = SLAM_REFIRE_DELAY + gpGlobals->curtime + SequenceDuration();
}
示例2: GetActivity
//-----------------------------------------------------------------------------
// Purpose: Allows the weapon to choose proper weapon idle animation
//-----------------------------------------------------------------------------
void CBaseHL2MPCombatWeapon::WeaponIdle( void )
{
//See if we should idle high or low
if ( WeaponShouldBeLowered() )
{
// Move to lowered position if we're not there yet
if ( GetActivity() != ACT_VM_IDLE_LOWERED && GetActivity() != ACT_VM_IDLE_TO_LOWERED
&& GetActivity() != ACT_TRANSITION )
{
SendWeaponAnim( ACT_VM_IDLE_LOWERED );
}
else if ( HasWeaponIdleTimeElapsed() )
{
// Keep idling low
SendWeaponAnim( ACT_VM_IDLE_LOWERED );
}
}
else
{
// See if we need to raise immediately
if ( m_flRaiseTime < gpGlobals->curtime && GetActivity() == ACT_VM_IDLE_LOWERED )
{
SendWeaponAnim( ACT_VM_IDLE );
}
else if ( HasWeaponIdleTimeElapsed() )
{
SendWeaponAnim( ACT_VM_IDLE );
}
}
}
示例3: StartSatchelDetonate
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeapon_SLAM::StartSatchelDetonate()
{
if ( GetActivity() != ACT_SLAM_DETONATOR_IDLE && GetActivity() != ACT_SLAM_THROW_IDLE )
return;
// -----------------------------------------
// Play detonate animation
// -----------------------------------------
if (m_bNeedReload)
{
SendWeaponAnim(ACT_SLAM_DETONATOR_DETONATE);
}
else if (m_tSlamState == SLAM_SATCHEL_ATTACH)
{
SendWeaponAnim(ACT_SLAM_STICKWALL_DETONATE);
}
else if (m_tSlamState == SLAM_SATCHEL_THROW)
{
SendWeaponAnim(ACT_SLAM_THROW_DETONATE);
}
else
{
return;
}
SatchelDetonate();
m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration();
m_flNextSecondaryAttack = gpGlobals->curtime + SequenceDuration();
}
示例4: MaxYawSpeed
//-----------------------------------------------------------------------------
// Purpose:
// Input:
// Output:
//-----------------------------------------------------------------------------
float CASW_Ranger::MaxYawSpeed( void )
{
if ( GetActivity() == ACT_STRAFE_LEFT || GetActivity() == ACT_STRAFE_RIGHT )
{
return 0.1f;
}
return 32.0f;// * GetMovementSpeedModifier();
}
示例5: Touch
void CXenPLight :: Touch( CBaseEntity *pOther )
{
if ( pOther->IsPlayer() )
{
pev->dmgtime = gpGlobals->time + XEN_PLANT_HIDE_TIME;
if ( GetActivity() == ACT_IDLE || GetActivity() == ACT_STAND )
{
SetActivity( ACT_CROUCH );
}
}
}
示例6: StudioFrameAdvance
void CBaseCombatWeapon::Operator_FrameUpdate( CBaseCombatCharacter *pOperator )
{
StudioFrameAdvance( ); // animate
if ( IsSequenceFinished() )
{
if ( SequenceLoops() )
{
// animation does loop, which means we're playing subtle idle. Might need to fidget.
int iSequence = SelectWeightedSequence( GetActivity() );
if ( iSequence != ACTIVITY_NOT_AVAILABLE )
{
ResetSequence( iSequence ); // Set to new anim (if it's there)
}
}
#if 0
else
{
// animation that just ended doesn't loop! That means we just finished a fidget
// and should return to our heaviest weighted idle (the subtle one)
SelectHeaviestSequence( GetActivity() );
}
#endif
}
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( pOwner == NULL )
return;
CBaseViewModel *vm = pOwner->GetViewModel( m_nViewModelIndex );
if ( vm == NULL )
return;
// HACK: Player weapon and view model often use the same mdl, which results
// in duplicate anim events. For now, let the view model handle the events
// if they're the same, which is the preferred behavior in general.
CStudioHdr *w_hdr = GetModelPtr();
CStudioHdr *v_hdr = vm->GetModelPtr();
if ( w_hdr->GetRenderHdr() != v_hdr->GetRenderHdr() )
{
// Animation events are passed back to the weapon's owner/operator
DispatchAnimEvents( pOperator );
}
// Update and dispatch the viewmodel events
if ( vm != NULL )
{
vm->StudioFrameAdvance();
vm->DispatchAnimEvents( this );
}
}
示例7: PrescheduleThink
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CNPC_Assassin::PrescheduleThink( void )
{
if ( GetActivity() == ACT_RUN || GetActivity() == ACT_WALK)
{
CPASAttenuationFilter filter( this );
static int iStep = 0;
iStep = ! iStep;
if (iStep)
{
EmitSound( filter, entindex(), "NPC_Assassin.Footstep" );
}
}
}
示例8: ShouldShowControlPanels
//-----------------------------------------------------------------------------
// Purpose:
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CWeaponBuilder::ShouldShowControlPanels( void )
{
if ( GetActivity() == ACT_VM_IDLE )
return true;
return false;
}
示例9: Think
void CXenPLight :: Think( void )
{
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1;
switch( GetActivity() )
{
case ACT_CROUCH:
if ( m_fSequenceFinished )
{
SetActivity( ACT_CROUCHIDLE );
LightOff();
}
break;
case ACT_CROUCHIDLE:
if ( gpGlobals->time > pev->dmgtime )
{
SetActivity( ACT_STAND );
LightOn();
}
break;
case ACT_STAND:
if ( m_fSequenceFinished )
SetActivity( ACT_IDLE );
break;
case ACT_IDLE:
default:
break;
}
}
示例10: GetActivity
ECode RestrictedSettingsFragment::OnDestroy()
{
AutoPtr<IActivity> activity;
GetActivity((IActivity**)&activity);
IContext::Probe(activity)->UnregisterReceiver(mScreenOffReceiver);
return SettingsPreferenceFragment::OnDestroy();
}
示例11: switch
float CNPC_Gargantua::MaxYawSpeed ( void )
{
float ys = 60;
switch ( GetActivity() )
{
case ACT_IDLE:
ys = 60;
break;
case ACT_TURN_LEFT:
case ACT_TURN_RIGHT:
ys = 180;
break;
case ACT_WALK:
case ACT_RUN:
ys = 60;
break;
default:
ys = 60;
break;
}
return ys;
}
示例12: switch
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
float CNPC_Headcrab::MaxYawSpeed ( void )
{
switch ( GetActivity() )
{
case ACT_IDLE:
return 30;
break;
case ACT_RUN:
case ACT_WALK:
return 20;
break;
case ACT_TURN_LEFT:
case ACT_TURN_RIGHT:
return 15;
break;
case ACT_RANGE_ATTACK1:
return 30;
break;
default:
return 30;
break;
}
return BaseClass::MaxYawSpeed();
}
示例13: ItemPostFrame
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFCompoundBow::ItemPostFrame( void )
{
BaseClass::ItemPostFrame();
if ( m_flChargeBeginTime != 0.0f )
{
float flChargeTime = gpGlobals->curtime - m_flChargeBeginTime;
if ( flChargeTime >= TF_BOW_CHARGE_TIRED_TIME )
{
// Play flinching animation if it was charged for too long.
if ( GetActivity() == ACT_ITEM2_VM_IDLE_2 )
{
SendWeaponAnim( ACT_ITEM2_VM_CHARGE_IDLE_3 );
}
else if ( IsViewModelSequenceFinished() )
{
SendWeaponAnim( ACT_ITEM2_VM_IDLE_3 );
}
}
else if ( IsViewModelSequenceFinished() )
{
SendWeaponAnim( ACT_ITEM2_VM_IDLE_2 );
}
}
}
示例14: RunAI
//========================================================
// RunAI - overridden for bullsquid because there are things
// that need to be checked every think.
//========================================================
void CNPC_Bullsquid::RunAI ( void )
{
// first, do base class stuff
BaseClass::RunAI();
if ( m_nSkin != 0 )
{
// close eye if it was open.
m_nSkin = 0;
}
if ( random->RandomInt( 0,39 ) == 0 )
{
m_nSkin = 1;
}
if ( GetEnemy() != NULL && GetActivity() == ACT_RUN )
{
// chasing enemy. Sprint for last bit
if ( (GetAbsOrigin() - GetEnemy()->GetAbsOrigin()).Length2D() < SQUID_SPRINT_DIST )
{
m_flPlaybackRate = 1.25;
}
}
}
示例15: SetNextThink
void CBaseTurret::Deploy(void)
{
SetNextThink( gpGlobals->curtime + 0.1f );
StudioFrameAdvance( );
if ( GetActivity() != ACT_TURRET_OPEN )
{
m_iOn = 1;
SetActivity( (Activity)ACT_TURRET_OPEN );
EmitSound( "NPC_Turret.Deploy" );
m_OnDeploy.FireOutput(NULL, this);
}
if (m_fSequenceFinished)
{
Vector curmins, curmaxs;
curmins = WorldAlignMins();
curmaxs = WorldAlignMaxs();
curmaxs.z = m_iDeployHeight;
curmins.z = -m_iDeployHeight;
SetCollisionBounds( curmins, curmaxs );
Relink();
SetActivity( (Activity)ACT_TURRET_OPEN_IDLE );
m_flPlaybackRate = 0;
SetThink(&CBaseTurret::SearchThink);
}
m_flLastSight = gpGlobals->curtime + m_flMaxWait;
}