本文整理汇总了C++中CBaseMonster::BarnacleVictimBitten方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseMonster::BarnacleVictimBitten方法的具体用法?C++ CBaseMonster::BarnacleVictimBitten怎么用?C++ CBaseMonster::BarnacleVictimBitten使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseMonster
的用法示例。
在下文中一共展示了CBaseMonster::BarnacleVictimBitten方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BarnacleThink
//=========================================================
//=========================================================
void CBarnacle :: BarnacleThink ( void )
{
CBaseEntity *pTouchEnt;
CBaseMonster *pVictim;
float flLength;
SetNextThink( 0.1 );
if ( m_hEnemy != NULL )
{
// barnacle has prey.
if ( !m_hEnemy->IsAlive() )
{
// someone (maybe even the barnacle) killed the prey. Reset barnacle.
m_fLiftingPrey = FALSE;// indicate that we're not lifting prey.
m_hEnemy = NULL;
return;
}
if ( m_fLiftingPrey )
{
if ( m_hEnemy != NULL && m_hEnemy->pev->deadflag != DEAD_NO )
{
// crap, someone killed the prey on the way up.
m_hEnemy = NULL;
m_fLiftingPrey = FALSE;
return;
}
// still pulling prey.
Vector vecNewEnemyOrigin = m_hEnemy->pev->origin;
vecNewEnemyOrigin.x = pev->origin.x;
vecNewEnemyOrigin.y = pev->origin.y;
// guess as to where their neck is
vecNewEnemyOrigin.x -= 6 * cos(m_hEnemy->pev->angles.y * M_PI/180.0);
vecNewEnemyOrigin.y -= 6 * sin(m_hEnemy->pev->angles.y * M_PI/180.0);
m_flAltitude -= BARNACLE_PULL_SPEED;
vecNewEnemyOrigin.z += BARNACLE_PULL_SPEED;
if ( fabs( pev->origin.z - ( vecNewEnemyOrigin.z + m_hEnemy->pev->view_ofs.z - 8 ) ) < BARNACLE_BODY_HEIGHT )
{
// prey has just been lifted into position ( if the victim origin + eye height + 8 is higher
// than the bottom of the barnacle, it is assumed that the head is within barnacle's body )
m_fLiftingPrey = FALSE;
EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_bite3.wav", 1, ATTN_NORM );
pVictim = m_hEnemy->MyMonsterPointer();
m_flKillVictimTime = gpGlobals->time + 10;// now that the victim is in place, the killing bite will be administered in 10 seconds.
if ( pVictim )
{
pVictim->BarnacleVictimBitten( pev );
SetActivity ( ACT_EAT );
}
}
UTIL_SetOrigin ( m_hEnemy, vecNewEnemyOrigin );
}
else
{
// prey is lifted fully into feeding position and is dangling there.
pVictim = m_hEnemy->MyMonsterPointer();
if ( m_flKillVictimTime != -1 && gpGlobals->time > m_flKillVictimTime )
{
// kill!
if ( pVictim )
{
pVictim->TakeDamage ( pev, pev, pVictim->pev->health, DMG_SLASH | DMG_ALWAYSGIB );
m_cGibs = 3;
}
return;
}
// bite prey every once in a while
if ( pVictim && ( RANDOM_LONG(0,49) == 0 ) )
{
switch ( RANDOM_LONG(0,2) )
{
case 0: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_chew1.wav", 1, ATTN_NORM ); break;
case 1: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_chew2.wav", 1, ATTN_NORM ); break;
case 2: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_chew3.wav", 1, ATTN_NORM ); break;
}
pVictim->BarnacleVictimBitten( pev );
}
}
}
else
{
//.........这里部分代码省略.........