本文整理汇总了C++中SetActivity函数的典型用法代码示例。如果您正苦于以下问题:C++ SetActivity函数的具体用法?C++ SetActivity怎么用?C++ SetActivity使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetActivity函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Precache
void CLeech::Spawn( void )
{
Precache();
SET_MODEL(ENT(pev), "models/leech.mdl");
// Just for fun
// SET_MODEL(ENT(pev), "models/icky.mdl");
// UTIL_SetSize( pev, g_vecZero, g_vecZero );
UTIL_SetSize( pev, Vector(-1,-1,0), Vector(1,1,2));
// Don't push the minz down too much or the water check will fail because this entity is really point-sized
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_FLY;
SetBits(pev->flags, FL_SWIM);
pev->health = gSkillData.leechHealth;
m_flFieldOfView = -0.5; // 180 degree FOV
m_flDistLook = 750;
MonsterInit();
SetThink( &CLeech::SwimThink );
SetUse( NULL );
SetTouch( NULL );
pev->view_ofs = g_vecZero;
m_flTurning = 0;
m_fPathBlocked = FALSE;
SetActivity( ACT_SWIM );
SetState( MONSTERSTATE_IDLE );
m_stateTime = gpGlobals->time + RANDOM_FLOAT( 1, 5 );
}
示例2: MonsterPain
void CShambler :: MonsterPain( CBaseEntity *pAttacker, float flDamage )
{
if( pev->owner )
{
// remove lightning (if present)
CBaseEntity *pLightning = CBaseEntity::Instance( pev->owner );
if( pLightning ) UTIL_Remove( pLightning );
pev->owner = NULL;
}
EMIT_SOUND( edict(), CHAN_VOICE, "shambler/shurt2.wav", 1.0, ATTN_NORM );
if( pev->health <= 0 )
return; // allready dying, don't go into pain frame
if (RANDOM_FLOAT( 0.0f, 1.0f ) * 400 > flDamage )
return; // didn't flinch
if (pev->pain_finished > gpGlobals->time)
return;
pev->pain_finished = gpGlobals->time + 2;
m_iAIState = STATE_PAIN;
SetActivity( ACT_BIG_FLINCH );
}
示例3: GetHullType
//---------------------------------------------------------
//---------------------------------------------------------
void CZombie::SetZombieModel( void )
{
Hull_t lastHull = GetHullType();
if ( m_fIsTorso )
{
SetModel( "models/zombie/classic_torso.mdl" );
SetHullType( HULL_TINY );
}
else
{
SetModel( "models/zombie/classic.mdl" );
SetHullType( HULL_HUMAN );
}
SetBodygroup( ZOMBIE_BODYGROUP_HEADCRAB, !m_fIsHeadless );
SetHullSizeNormal( true );
SetDefaultEyeOffset();
SetActivity( ACT_IDLE );
// hull changed size, notify vphysics
// UNDONE: Solve this generally, systematically so other
// NPCs can change size
if ( lastHull != GetHullType() )
{
if ( VPhysicsGetObject() )
{
SetupVPhysicsHull();
}
}
}
示例4: MonsterMeleeAttack
void CHellKnight :: MonsterMeleeAttack( void )
{
m_iAIState = STATE_ATTACK;
EMIT_SOUND( edict(), CHAN_WEAPON, "hknight/slash1.wav", 1.0, ATTN_NORM );
SetActivity( ACT_MELEE_ATTACK1 );
m_flMonsterSpeed = 0;
}
示例5: Spawn
//=========================================================
// Spawn
//=========================================================
void CRoach :: Spawn()
{
Precache( );
SET_MODEL(ENT(pev), "models/roach.mdl");
UTIL_SetSize( pev, Vector( -1, -1, 0 ), Vector( 1, 1, 2 ) );
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_YELLOW;
pev->effects = 0;
pev->health = 1;
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
this->pev->classname = ALLOC_STRING(kRoachClassName);
MonsterInit();
SetActivity ( ACT_IDLE );
pev->view_ofs = Vector ( 0, 0, 1 );// position of the eyes relative to monster's origin.
pev->takedamage = DAMAGE_YES;
m_fLightHacked = FALSE;
m_flLastLightLevel = -1;
m_iMode = ROACH_IDLE;
m_flNextSmellTime = gpGlobals->time;
}
示例6: SelectHeaviestSequence
void QUA_helicopter::SetActivity(Activity NewActivity) {
int sequence;
if (m_Activity == NewActivity)
{
return;
} else {
sequence = SelectHeaviestSequence( NewActivity );
//int sequence = this->LookupSequence("Idle01");
if ( sequence != ACTIVITY_NOT_AVAILABLE )
{
m_Activity=NewActivity;
SetSequence( sequence );
SetActivity(NewActivity);
SetCycle( 0 );
ResetSequenceInfo( );
if(NewActivity==ACT_MELEE_ATTACK1) {
SetPlaybackRate(2.0f);
} else {
SetPlaybackRate(1.0f);
}
//m_Activity=NewActivity;
} else {
return;
}
}
}
示例7: Killed
//=========================================================
// Killed.
//=========================================================
void CBarnacle :: Killed( entvars_t *pevAttacker, int iGib )
{
CBaseMonster *pVictim;
pev->solid = SOLID_NOT;
pev->takedamage = DAMAGE_NO;
if ( m_hEnemy != NULL )
{
pVictim = m_hEnemy->MyMonsterPointer();
if ( pVictim )
{
pVictim->BarnacleVictimReleased();
}
}
// CGib::SpawnRandomGibs( pev, 4, 1 );
switch ( RANDOM_LONG ( 0, 1 ) )
{
case 0: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_die1.wav", 1, ATTN_NORM ); break;
case 1: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_die3.wav", 1, ATTN_NORM ); break;
}
SetActivity ( ACT_DIESIMPLE );
SetBoneController( 0, 0 );
StudioFrameAdvance( 0.1 );
SetNextThink( 0.1 );
SetThink(&CBarnacle :: WaitTillDead );
}
示例8: SetThink
void CLeech::DeadThink( void )
{
if ( m_fSequenceFinished )
{
if ( m_Activity == ACT_DIEFORWARD )
{
SetThink( NULL );
StopAnimation();
return;
}
else if ( pev->flags & FL_ONGROUND )
{
pev->solid = SOLID_NOT;
SetActivity(ACT_DIEFORWARD);
}
}
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1;
// Apply damage velocity, but keep out of the walls
if ( pev->velocity.x != 0 || pev->velocity.y != 0 )
{
TraceResult tr;
// Look 0.5 seconds ahead
UTIL_TraceLine(pev->origin, pev->origin + pev->velocity * 0.5, missile, edict(), &tr);
if (tr.flFraction != 1.0)
{
pev->velocity.x = 0;
pev->velocity.y = 0;
}
}
}
示例9: GetHullType
void CZombie::SetZombieModel( void )
{
Hull_t lastHull = GetHullType();
if(m_iZombieType == ZOMBIE_BISOU)
SetModel( "models/zombie/Bisounours.mdl" );
else
SetModel( "models/zombie/classic.mdl" );
SetHullType( HULL_HUMAN );
//Commenté en attendant de trouver à quoi ça sert
//SetBodygroup( ZOMBIE_BODYGROUP_HEADCRAB, !m_fIsHeadless );
SetHullSizeNormal( true );
SetDefaultEyeOffset();
SetActivity( ACT_IDLE );
// hull changed size, notify vphysics
// UNDONE: Solve this generally, systematically so other
// NPCs can change size
if ( lastHull != GetHullType() )
if ( VPhysicsGetObject() )
SetupVPhysicsHull();
}
示例10: SetSmoothedVelocity
AIMoveResult_t CAI_Motor::MoveJumpStop()
{
SetSmoothedVelocity( Vector(0,0,0) );
if (GetOuter()->GetActivity() == ACT_GLIDE)
{
float flTime = GetOuter()->GetGroundChangeTime();
GetOuter()->AddStepDiscontinuity( flTime, GetAbsOrigin(), GetAbsAngles() );
if ( SelectWeightedSequence( ACT_LAND ) == ACT_INVALID )
return AIMR_CHANGE_TYPE;
SetActivity( ACT_LAND );
// FIXME: find out why the client doesn't interpolate immediatly after sequence change
// GetOuter()->SetCycle( flTime - gpGlobals->curtime );
}
if (GetOuter()->GetActivity() != ACT_LAND || GetOuter()->IsActivityFinished())
{
return AIMR_CHANGE_TYPE;
}
SetMoveInterval( 0 );
SetGravity( 1.0f );
return AIMR_OK;
}
示例11: SetActivity
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CObjectTeleporter::FinishedBuilding( void )
{
BaseClass::FinishedBuilding();
SetActivity( ACT_OBJ_RUNNING );
SetPlaybackRate( 0.0f );
}
示例12: Vector
void CHostage::RePosition(void)
{
pev->health = pev->max_health;
pev->movetype = MOVETYPE_STEP;
pev->solid = SOLID_SLIDEBOX;
pev->takedamage = DAMAGE_YES;
pev->deadflag = DEAD_NO;
pev->velocity = Vector(0, 0, 0);
pev->angles = m_vStartAngles;
pev->effects &= ~EF_NODRAW;
m_hTargetEnt = NULL;
m_hStoppedTargetEnt = NULL;
m_bTouched = FALSE;
m_bRescueMe = FALSE;
m_vOldPos = Vector(9999, 9999, 9999);
m_flNextRadarTime = 0;
UTIL_SetOrigin(pev, m_vStart);
UTIL_SetSize(pev, VEC_HOSTAGE_HULL_MIN, VEC_HOSTAGE_HULL_MAX);
DROP_TO_FLOOR(ENT(pev));
SetActivity(ACT_IDLE);
SetThink(&CHostage::IdleThink);
pev->nextthink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2);
m_fHasPath = FALSE;
nTargetNode = -1;
m_flLastPathCheck = -1;
m_flPathAcquired = -1;
m_flPathCheckInterval = 0.1;
m_flNextFullThink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2);
}
示例13: SetActivity
void CASW_Weapon_Minigun::UpdateSpinningBarrel()
{
if (GetSequenceActivity(GetSequence()) != ACT_VM_PRIMARYATTACK)
{
SetActivity(ACT_VM_PRIMARYATTACK, 0);
}
m_flPlaybackRate = GetSpinRate();
if ( GetSpinRate() > 0.0f )
{
if( !m_pBarrelSpinSound )
{
CPASAttenuationFilter filter( this );
m_pBarrelSpinSound = CSoundEnvelopeController::GetController().SoundCreate( filter, entindex(), "ASW_Minigun.Spin" );
CSoundEnvelopeController::GetController().Play( m_pBarrelSpinSound, 0.0, 100 );
}
CSoundEnvelopeController::GetController().SoundChangeVolume( m_pBarrelSpinSound, MIN( 1.0f, m_flPlaybackRate * 3.0f ), 0.0f );
CSoundEnvelopeController::GetController().SoundChangePitch( m_pBarrelSpinSound, asw_minigun_pitch_min.GetFloat() + ( GetSpinRate() * ( asw_minigun_pitch_max.GetFloat() - asw_minigun_pitch_min.GetFloat() ) ), 0.0f );
}
else
{
if ( m_pBarrelSpinSound )
{
CSoundEnvelopeController::GetController().SoundDestroy( m_pBarrelSpinSound );
m_pBarrelSpinSound = NULL;
}
}
}
示例14: Start
//=========================================================
// Start - player enters the pvs, so get things going.
//=========================================================
void CFlockingFlyer :: Start( void )
{
pev->nextthink = gpGlobals->time + 0.1;
if ( IsLeader() )
{
SetThink( &CFlockingFlyer::FlockLeaderThink );
}
else
{
SetThink( &CFlockingFlyer::FlockFollowerThink );
}
/*
Vector vecTakeOff;
vecTakeOff = Vector ( 0 , 0 , 0 );
vecTakeOff.z = 50 + RANDOM_FLOAT ( 0, 100 );
vecTakeOff.x = 20 - RANDOM_FLOAT ( 0, 40);
vecTakeOff.y = 20 - RANDOM_FLOAT ( 0, 40);
pev->velocity = vecTakeOff;
pev->speed = pev->velocity.Length();
pev->sequence = 0;
*/
SetActivity ( ACT_FLY );
ResetSequenceInfo( );
BoidAdvanceFrame( );
pev->speed = AFLOCK_FLY_SPEED;// no delay!
}
示例15: Spawn
//=========================================================
// Spawn
//=========================================================
void CBarnacle :: Spawn()
{
Precache( );
if (pev->model)
SET_MODEL(ENT(pev), STRING(pev->model)); //LRC
else
SET_MODEL(ENT(pev), "models/barnacle.mdl");
UTIL_SetSize( pev, Vector(-16, -16, -32), Vector(16, 16, 0) );
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_NONE;
pev->takedamage = DAMAGE_AIM;
m_bloodColor = BLOOD_COLOR_RED;
pev->effects = EF_INVLIGHT; // take light from the ceiling
pev->health = 25;
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
m_flKillVictimTime = 0;
m_cGibs = 0;
m_fLiftingPrey = FALSE;
m_flTongueAdj = -100;
InitBoneControllers();
SetActivity ( ACT_IDLE );
SetThink(&CBarnacle :: BarnacleThink );
SetNextThink( 0.5 );
UTIL_SetOrigin ( this, pev->origin );
}