本文整理汇总了C++中HasConditions函数的典型用法代码示例。如果您正苦于以下问题:C++ HasConditions函数的具体用法?C++ HasConditions怎么用?C++ HasConditions使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HasConditions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSchedule
//=========================================================
// GetSchedule - Decides which type of schedule best suits
// the monster's current state and conditions. Then calls
// monster's member function to get a pointer to a schedule
// of the proper type.
//=========================================================
Schedule_t *CController :: GetSchedule ( void )
{
switch ( m_MonsterState )
{
case MONSTERSTATE_IDLE:
break;
case MONSTERSTATE_ALERT:
break;
case MONSTERSTATE_COMBAT:
{
Vector vecTmp = Intersect( Vector( 0, 0, 0 ), Vector( 100, 4, 7 ), Vector( 2, 10, -3 ), 20.0 );
// dead enemy
if ( HasConditions ( bits_COND_LIGHT_DAMAGE ) )
{
// m_iFrustration++;
}
if ( HasConditions ( bits_COND_HEAVY_DAMAGE ) )
{
// m_iFrustration++;
}
}
break;
}
return CSquadMonster :: GetSchedule();
}
示例2: FScheduleValid
//=========================================================
// FScheduleValid - returns TRUE as long as the current
// schedule is still the proper schedule to be executing,
// taking into account all conditions
//=========================================================
BOOL CBaseMonster :: FScheduleValid ( void )
{
if ( m_pSchedule == NULL )
{
// schedule is empty, and therefore not valid.
return FALSE;
}
if ( HasConditions( m_pSchedule->iInterruptMask | bits_COND_SCHEDULE_DONE | bits_COND_TASK_FAILED ) )
{
#ifdef DEBUG
if ( HasConditions ( bits_COND_TASK_FAILED ) && m_failSchedule == SCHED_NONE )
{
// fail! Send a visual indicator.
Vector tmp = pev->origin;
tmp.z = pev->absmax.z + 16;
UTIL_Sparks( tmp );
}
#endif // DEBUG
// some condition has interrupted the schedule, or the schedule is done
return FALSE;
}
return TRUE;
}
示例3: GetSchedule
//=========================================================
// GetSchedule
//=========================================================
Schedule_t *CHoundeye :: GetSchedule( void )
{
switch ( m_MonsterState )
{
case MONSTERSTATE_COMBAT:
{
// dead enemy
if ( HasConditions( bits_COND_ENEMY_DEAD ) )
{
// call base class, all code to handle dead enemies is centralized there.
return CBaseMonster :: GetSchedule();
}
if ( HasConditions( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE ) )
{
if ( RANDOM_FLOAT( 0 , 1 ) <= 0.4 )
{
TraceResult tr;
UTIL_MakeVectors( pev->angles );
UTIL_TraceHull( pev->origin, pev->origin + gpGlobals->v_forward * -128, dont_ignore_monsters, head_hull, ENT( pev ), &tr );
if ( tr.flFraction == 1.0 )
{
// it's clear behind, so the hound will jump
return GetScheduleOfType ( SCHED_HOUND_HOP_RETREAT );
}
}
return GetScheduleOfType ( SCHED_TAKE_COVER_FROM_ENEMY );
}
if ( HasConditions( bits_COND_CAN_RANGE_ATTACK1 ) )
{
if ( OccupySlot ( bits_SLOTS_HOUND_ATTACK ) )
{
return GetScheduleOfType ( SCHED_RANGE_ATTACK1 );
}
return GetScheduleOfType ( SCHED_HOUND_AGITATED );
}
break;
}
default:
break;
}
return CSquadMonster :: GetSchedule();
}
示例4: CheckRangeAttack2
//=========================================================
// CheckRangeAttack2 - toss grenade is enemy gets in the way and is too close.
//=========================================================
BOOL CHAssassin :: CheckRangeAttack2 ( float flDot, float flDist )
{
m_fThrowGrenade = FALSE;
if ( !FBitSet ( m_hEnemy->pev->flags, FL_ONGROUND ) )
{
// don't throw grenades at anything that isn't on the ground!
return FALSE;
}
// don't get grenade happy unless the player starts to piss you off
if ( m_iFrustration <= 2)
return FALSE;
if ( m_flNextGrenadeCheck < gpGlobals->time && !HasConditions( bits_COND_ENEMY_OCCLUDED ) && flDist <= 512 /* && flDot >= 0.5 */ /* && NoFriendlyFire() */ )
{
Vector vecToss = VecCheckThrow( pev, GetGunPosition( ), m_hEnemy->Center(), flDist, 0.5 ); // use dist as speed to get there in 1 second
if ( vecToss != g_vecZero )
{
m_vecTossVelocity = vecToss;
// throw a hand grenade
m_fThrowGrenade = TRUE;
return TRUE;
}
}
return FALSE;
}
示例5: CheckRangeAttack1
//=========================================================
// CheckRangeAttack1
//
// !!!LATER - we may want to load balance this. Several
// tracelines are done, so we may not want to do this every
// server frame. Definitely not while firing.
//=========================================================
BOOL CAGrunt :: CheckRangeAttack1 ( float flDot, float flDist )
{
if ( gpGlobals->time < m_flNextHornetAttackCheck )
{
return m_fCanHornetAttack;
}
if ( HasConditions( bits_COND_SEE_ENEMY ) && flDist >= AGRUNT_MELEE_DIST && flDist <= 1024 && flDot >= 0.5 && NoFriendlyFire() )
{
TraceResult tr;
Vector vecArmPos, vecArmDir;
// verify that a shot fired from the gun will hit the enemy before the world.
// !!!LATER - we may wish to do something different for projectile weapons as opposed to instant-hit
UTIL_MakeVectors( pev->angles );
GetAttachment( 0, vecArmPos, vecArmDir );
// UTIL_TraceLine( vecArmPos, vecArmPos + gpGlobals->v_forward * 256, ignore_monsters, ENT(pev), &tr);
UTIL_TraceLine( vecArmPos, m_hEnemy->BodyTarget(vecArmPos), dont_ignore_monsters, ENT(pev), &tr);
if ( tr.flFraction == 1.0 || tr.pHit == m_hEnemy->edict() )
{
m_flNextHornetAttackCheck = gpGlobals->time + RANDOM_FLOAT( 2, 5 );
m_fCanHornetAttack = TRUE;
return m_fCanHornetAttack;
}
}
m_flNextHornetAttackCheck = gpGlobals->time + 0.2;// don't check for half second if this check wasn't successful
m_fCanHornetAttack = FALSE;
return m_fCanHornetAttack;
}
示例6: GetSchedule
//=========================================================
// GetSchedule - Decides which type of schedule best suits
// the monster's current state and conditions. Then calls
// monster's member function to get a pointer to a schedule
// of the proper type.
//=========================================================
Schedule_t *CLuciole :: GetSchedule ( void )
{
switch ( m_MonsterState )
{
case MONSTERSTATE_IDLE:
break;
case MONSTERSTATE_ALERT:
break;
case MONSTERSTATE_COMBAT:
{
if ( HasConditions(bits_COND_NEW_ENEMY) ) // une seule réorganisation par ennemi
{
// if ( VARS(m_hEnemy) != VARS(Leader()->m_hEnemy) )
{
ReorganiseSquad ();
}
}
/* if ( gpGlobals->time - m_flLastAttack < ATTACK_DELAY && IsLeader() )
return GetScheduleOfType ( SCHED_TAKE_COVER_FROM_ENEMY );
else
*/ return GetScheduleOfType ( SCHED_CHASE_ENEMY );
}
break;
}
return CBaseMonster :: GetSchedule();
}
示例7: PrescheduleThink
//=========================================================
// If there's a player around, watch him.
//=========================================================
void CTalkMonster :: PrescheduleThink ( void )
{
if ( !HasConditions ( bits_COND_SEE_CLIENT ) )
{
SetConditions ( bits_COND_CLIENT_UNSEEN );
}
}
示例8: CheckMeleeAttack1
//=========================================================
// CheckMeleeAttack1 - alien grunts zap the crap out of
// any enemy that gets too close.
//=========================================================
BOOL CAGrunt :: CheckMeleeAttack1 ( float flDot, float flDist )
{
if ( HasConditions ( bits_COND_SEE_ENEMY ) && flDist <= AGRUNT_MELEE_DIST && flDot >= 0.6 && m_hEnemy != NULL )
{
return TRUE;
}
return FALSE;
}
示例9: CheckMeleeAttack2
//=========================================================
// CheckMeleeAttack2 - bullsquid is a big guy, so has a longer
// melee range than most monsters. This is the bite attack.
// this attack will not be performed if the tailwhip attack
// is valid.
//=========================================================
BOOL CBullsquid :: CheckMeleeAttack2 ( float flDot, float flDist )
{
if ( flDist <= 85 && flDot >= 0.7 && !HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) ) // The player & bullsquid can be as much as their bboxes
{ // apart (48 * sqrt(3)) and he can still attack (85 is a little more than 48*sqrt(3))
return TRUE;
}
return FALSE;
}
示例10: GetScheduleOfType
//=========================================================
//=========================================================
Schedule_t* CAGrunt :: GetScheduleOfType ( int Type )
{
switch ( Type )
{
case SCHED_TAKE_COVER_FROM_ENEMY:
return &slAGruntTakeCoverFromEnemy[ 0 ];
break;
case SCHED_RANGE_ATTACK1:
if ( HasConditions( bits_COND_SEE_ENEMY ) )
{
//normal attack
return &slAGruntRangeAttack1[ 0 ];
}
else
{
// attack an unseen enemy
// return &slAGruntHiddenRangeAttack[ 0 ];
return &slAGruntRangeAttack1[ 0 ];
}
break;
case SCHED_AGRUNT_THREAT_DISPLAY:
return &slAGruntThreatDisplay[ 0 ];
break;
case SCHED_AGRUNT_SUPPRESS:
return &slAGruntSuppress[ 0 ];
break;
case SCHED_STANDOFF:
return &slAGruntStandoff[ 0 ];
break;
case SCHED_VICTORY_DANCE:
return &slAGruntVictoryDance[ 0 ];
break;
case SCHED_FAIL:
// no fail schedule specified, so pick a good generic one.
{
if ( m_hEnemy != NULL )
{
// I have an enemy
// !!!LATER - what if this enemy is really far away and i'm chasing him?
// this schedule will make me stop, face his last known position for 2
// seconds, and then try to move again
return &slAGruntCombatFail[ 0 ];
}
return &slAGruntFail[ 0 ];
}
break;
}
return CSquadMonster :: GetScheduleOfType( Type );
}
示例11: FCanCheckAttacks
//=========================================================
// FCanCheckAttacks - this is overridden for alien grunts
// because they can use their smart weapons against unseen
// enemies. Base class doesn't attack anyone it can't see.
//=========================================================
BOOL CAGrunt :: FCanCheckAttacks ( void )
{
if ( !HasConditions( bits_COND_ENEMY_TOOFAR ) )
{
return TRUE;
}
else
{
return FALSE;
}
}
示例12: PrescheduleThink
void CGargantua :: PrescheduleThink( void )
{
if ( !HasConditions( bits_COND_SEE_ENEMY ) )
{
m_seeTime = gpGlobals->time + 5;
EyeOff();
}
else
EyeOn( 200 );
EyeUpdate();
}
示例13: GetSchedule
//=========================================================
// GetSchedule - Decides which type of schedule best suits
// the monster's current state and conditions. Then calls
// monster's member function to get a pointer to a schedule
// of the proper type.
//=========================================================
Schedule_t *CAGrunt :: GetSchedule ( void )
{
if ( HasConditions(bits_COND_HEAR_SOUND) )
{
CSound *pSound;
pSound = PBestSound();
ASSERT( pSound != NULL );
if ( pSound && (pSound->m_iType & bits_SOUND_DANGER) )
{
// dangerous sound nearby!
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_BEST_SOUND );
}
}
switch ( m_MonsterState )
{
case MONSTERSTATE_COMBAT:
{
// dead enemy
if ( HasConditions( bits_COND_ENEMY_DEAD ) )
{
// call base class, all code to handle dead enemies is centralized there.
return CBaseMonster :: GetSchedule();
}
if ( HasConditions(bits_COND_NEW_ENEMY) )
{
return GetScheduleOfType( SCHED_WAKE_ANGRY );
}
// zap player!
if ( HasConditions ( bits_COND_CAN_MELEE_ATTACK1 ) )
{
AttackSound();// this is a total hack. Should be parto f the schedule
return GetScheduleOfType ( SCHED_MELEE_ATTACK1 );
}
if ( HasConditions ( bits_COND_HEAVY_DAMAGE ) )
{
return GetScheduleOfType( SCHED_SMALL_FLINCH );
}
// can attack
if ( HasConditions ( bits_COND_CAN_RANGE_ATTACK1 ) && OccupySlot ( bits_SLOTS_AGRUNT_HORNET ) )
{
return GetScheduleOfType ( SCHED_RANGE_ATTACK1 );
}
if ( OccupySlot ( bits_SLOT_AGRUNT_CHASE ) )
{
return GetScheduleOfType ( SCHED_CHASE_ENEMY );
}
return GetScheduleOfType ( SCHED_STANDOFF );
}
}
return CSquadMonster :: GetSchedule();
}
示例14: switch
//=========================================================
// GetSchedule
//=========================================================
Schedule_t* CIchthyosaur::GetSchedule()
{
// ALERT( at_console, "GetSchedule( )\n" );
switch(m_MonsterState)
{
case MONSTERSTATE_IDLE:
m_flightSpeed = 80;
return GetScheduleOfType( SCHED_IDLE_WALK );
case MONSTERSTATE_ALERT:
m_flightSpeed = 150;
return GetScheduleOfType( SCHED_IDLE_WALK );
case MONSTERSTATE_COMBAT:
m_flMaxSpeed = 400;
// eat them
if ( HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) )
{
return GetScheduleOfType( SCHED_MELEE_ATTACK1 );
}
// chase them down and eat them
if ( HasConditions( bits_COND_CAN_RANGE_ATTACK1 ) )
{
return GetScheduleOfType( SCHED_CHASE_ENEMY );
}
if ( HasConditions( bits_COND_HEAVY_DAMAGE ) )
{
m_bOnAttack = TRUE;
}
if ( pev->health < pev->max_health - 20 )
{
m_bOnAttack = TRUE;
}
return GetScheduleOfType( SCHED_STANDOFF );
}
return CFlyingMonster :: GetSchedule();
}
示例15: GetSchedule
//=========================================================
//=========================================================
Schedule_t *CISlave :: GetSchedule( void )
{
ClearBeams( );
/*
if (pev->spawnflags)
{
pev->spawnflags = 0;
return GetScheduleOfType( SCHED_RELOAD );
}
*/
if ( HasConditions( bits_COND_HEAR_SOUND ) )
{
CSound *pSound;
pSound = PBestSound();
ASSERT( pSound != NULL );
if ( pSound && (pSound->m_iType & bits_SOUND_DANGER) )
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_BEST_SOUND );
if ( pSound->m_iType & bits_SOUND_COMBAT )
m_afMemory |= bits_MEMORY_PROVOKED;
}
switch (m_MonsterState)
{
case MONSTERSTATE_COMBAT:
// dead enemy
if ( HasConditions( bits_COND_ENEMY_DEAD ) )
{
// call base class, all code to handle dead enemies is centralized there.
return CBaseMonster :: GetSchedule();
}
if (pev->health < 20 || m_iBravery < 0)
{
if (!HasConditions( bits_COND_CAN_MELEE_ATTACK1 ))
{
m_failSchedule = SCHED_CHASE_ENEMY;
if (HasConditions( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE))
{
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ENEMY );
}
if ( HasConditions ( bits_COND_SEE_ENEMY ) && HasConditions ( bits_COND_ENEMY_FACING_ME ) )
{
// ALERT( at_console, "exposed\n");
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ENEMY );
}
}
}
break;
default:
break;
}
return CSquadMonster::GetSchedule( );
}