本文整理汇总了C++中CNihilanthHVR类的典型用法代码示例。如果您正苦于以下问题:C++ CNihilanthHVR类的具体用法?C++ CNihilanthHVR怎么用?C++ CNihilanthHVR使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CNihilanthHVR类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EmitSphere
BOOL CNihilanth :: EmitSphere( void )
{
m_iActiveSpheres = 0;
int empty = 0;
for (int i = 0; i < N_SPHERES; i++)
{
if (m_hSphere[i] != NULL)
{
m_iActiveSpheres++;
}
else
{
empty = i;
}
}
if (m_iActiveSpheres >= N_SPHERES)
return FALSE;
Vector vecSrc = m_hRecharger->pev->origin;
CNihilanthHVR *pEntity = (CNihilanthHVR *)Create( "nihilanth_energy_ball", vecSrc, pev->angles, edict() );
pEntity->pev->velocity = pev->origin - vecSrc;
pEntity->CircleInit( this );
m_hSphere[empty] = pEntity;
return TRUE;
}
示例2: ShootBalls
void CNihilanth :: ShootBalls( void )
{
if (m_flShootEnd > gpGlobals->time)
{
Vector vecHand, vecAngle;
while (m_flShootTime < m_flShootEnd && m_flShootTime < gpGlobals->time)
{
if (m_hEnemy != NULL)
{
Vector vecSrc, vecDir;
CNihilanthHVR *pEntity;
GetAttachment( 2, vecHand, vecAngle );
vecSrc = vecHand + pev->velocity * (m_flShootTime - gpGlobals->time);
// vecDir = (m_posTarget - vecSrc).Normalize( );
vecDir = (m_posTarget - pev->origin).Normalize( );
vecSrc = vecSrc + vecDir * (gpGlobals->time - m_flShootTime);
pEntity = (CNihilanthHVR *)Create( "nihilanth_energy_ball", vecSrc, pev->angles, edict() );
pEntity->pev->velocity = vecDir * 200.0;
pEntity->ZapInit( m_hEnemy );
GetAttachment( 3, vecHand, vecAngle );
vecSrc = vecHand + pev->velocity * (m_flShootTime - gpGlobals->time);
// vecDir = (m_posTarget - vecSrc).Normalize( );
vecDir = (m_posTarget - pev->origin).Normalize( );
vecSrc = vecSrc + vecDir * (gpGlobals->time - m_flShootTime);
pEntity = (CNihilanthHVR *)Create( "nihilanth_energy_ball", vecSrc, pev->angles, edict() );
pEntity->pev->velocity = vecDir * 200.0;
pEntity->ZapInit( m_hEnemy );
}
m_flShootTime += 0.2;
}
}
}
示例3: AbsorbSphere
BOOL CNihilanth :: AbsorbSphere( void )
{
for (int i = 0; i < N_SPHERES; i++)
{
if (m_hSphere[i] != NULL)
{
CNihilanthHVR *pSphere = (CNihilanthHVR *)((CBaseEntity *)m_hSphere[i]);
pSphere->AbsorbInit( );
m_hSphere[i] = NULL;
m_iActiveSpheres--;
return TRUE;
}
}
return FALSE;
}
示例4: AbsorbSphere
bool CNihilanth::AbsorbSphere()
{
for (int i = 0; i < N_SPHERES; i++)
{
if (m_hSphere[i] != NULL)
{
CNihilanthHVR *pSphere = (CNihilanthHVR *)((CBaseEntity *)m_hSphere[i]);
pSphere->AbsorbInit( );
m_hSphere[i] = NULL;
m_iActiveSpheres--;
return true;
}
}
return false;
}
示例5: HandleAnimEvent
void CNihilanth :: HandleAnimEvent( MonsterEvent_t *pEvent )
{
switch( pEvent->event )
{
case 1: // shoot
break;
case 2: // zen
if (m_hEnemy != NULL)
{
if (RANDOM_LONG(0,4) == 0)
EMIT_SOUND( edict(), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0, 0.2 );
EMIT_SOUND( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pBallSounds ), 1.0, 0.2 );
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_ELIGHT );
WRITE_SHORT( entindex( ) + 0x3000 ); // entity, attachment
WRITE_COORD( pev->origin.x ); // origin
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z );
WRITE_COORD( 256 ); // radius
WRITE_BYTE( 128 ); // R
WRITE_BYTE( 128 ); // G
WRITE_BYTE( 255 ); // B
WRITE_BYTE( 10 ); // life * 10
WRITE_COORD( 128 ); // decay
MESSAGE_END();
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_ELIGHT );
WRITE_SHORT( entindex( ) + 0x4000 ); // entity, attachment
WRITE_COORD( pev->origin.x ); // origin
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z );
WRITE_COORD( 256 ); // radius
WRITE_BYTE( 128 ); // R
WRITE_BYTE( 128 ); // G
WRITE_BYTE( 255 ); // B
WRITE_BYTE( 10 ); // life * 10
WRITE_COORD( 128 ); // decay
MESSAGE_END();
m_flShootTime = gpGlobals->time;
m_flShootEnd = gpGlobals->time + 1.0;
}
break;
case 3: // prayer
if (m_hEnemy != NULL)
{
char szText[32];
sprintf( szText, "%s%d", m_szTeleportTouch, m_iTeleport );
CBaseEntity *pTouch = UTIL_FindEntityByTargetname( NULL, szText );
sprintf( szText, "%s%d", m_szTeleportUse, m_iTeleport );
CBaseEntity *pTrigger = UTIL_FindEntityByTargetname( NULL, szText );
if (pTrigger != NULL || pTouch != NULL)
{
EMIT_SOUND( edict(), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0, 0.2 );
Vector vecSrc, vecAngles;
GetAttachment( 2, vecSrc, vecAngles );
CNihilanthHVR *pEntity = (CNihilanthHVR *)Create( "nihilanth_energy_ball", vecSrc, pev->angles, edict() );
pEntity->pev->velocity = pev->origin - vecSrc;
pEntity->TeleportInit( this, m_hEnemy, pTrigger, pTouch );
}
else
{
m_iTeleport++; // unexpected failure
EMIT_SOUND( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pBallSounds ), 1.0, 0.2 );
ALERT( at_aiconsole, "nihilanth can't target %s\n", szText );
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_ELIGHT );
WRITE_SHORT( entindex( ) + 0x3000 ); // entity, attachment
WRITE_COORD( pev->origin.x ); // origin
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z );
WRITE_COORD( 256 ); // radius
WRITE_BYTE( 128 ); // R
WRITE_BYTE( 128 ); // G
WRITE_BYTE( 255 ); // B
WRITE_BYTE( 10 ); // life * 10
WRITE_COORD( 128 ); // decay
MESSAGE_END();
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_ELIGHT );
WRITE_SHORT( entindex( ) + 0x4000 ); // entity, attachment
WRITE_COORD( pev->origin.x ); // origin
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z );
WRITE_COORD( 256 ); // radius
WRITE_BYTE( 128 ); // R
WRITE_BYTE( 128 ); // G
WRITE_BYTE( 255 ); // B
WRITE_BYTE( 10 ); // life * 10
//.........这里部分代码省略.........
示例6: DyingThink
//.........这里部分代码省略.........
{
Flight( );
if (fabs( pev->origin.z - m_flMaxZ ) < 16)
{
pev->velocity = Vector( 0, 0, 0 );
FireTargets( m_szDeadUse, this, this, USE_ON, 1.0 );
pev->deadflag = DEAD_DEAD;
}
}
if (m_fSequenceFinished)
{
pev->avelocity.y += RANDOM_FLOAT( -100, 100 );
if (pev->avelocity.y < -100)
pev->avelocity.y = -100;
if (pev->avelocity.y > 100)
pev->avelocity.y = 100;
pev->sequence = LookupSequence( "die1" );
}
if (m_pBall)
{
if (m_pBall->pev->renderamt > 0)
{
m_pBall->pev->renderamt = max( 0, m_pBall->pev->renderamt - 2);
}
else
{
UTIL_Remove( m_pBall );
m_pBall = NULL;
}
}
Vector vecDir, vecSrc, vecAngles;
UTIL_MakeAimVectors( pev->angles );
int iAttachment = RANDOM_LONG( 1, 4 );
do {
vecDir = Vector( RANDOM_FLOAT( -1, 1 ), RANDOM_FLOAT( -1, 1 ), RANDOM_FLOAT( -1, 1 ));
} while (DotProduct( vecDir, vecDir) > 1.0);
switch( RANDOM_LONG( 1, 4 ))
{
case 1: // head
vecDir.z = fabs( vecDir.z ) * 0.5;
vecDir = vecDir + 2 * gpGlobals->v_up;
break;
case 2: // eyes
if (DotProduct( vecDir, gpGlobals->v_forward ) < 0)
vecDir = vecDir * -1;
vecDir = vecDir + 2 * gpGlobals->v_forward;
break;
case 3: // left hand
if (DotProduct( vecDir, gpGlobals->v_right ) > 0)
vecDir = vecDir * -1;
vecDir = vecDir - 2 * gpGlobals->v_right;
break;
case 4: // right hand
if (DotProduct( vecDir, gpGlobals->v_right ) < 0)
vecDir = vecDir * -1;
vecDir = vecDir + 2 * gpGlobals->v_right;
break;
}
GetAttachment( iAttachment - 1, vecSrc, vecAngles );
TraceResult tr;
UTIL_TraceLine( vecSrc, vecSrc + vecDir * 4096, ignore_monsters, ENT(pev), &tr );
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_BEAMENTPOINT );
WRITE_SHORT( entindex() + 0x1000 * iAttachment );
WRITE_COORD( tr.vecEndPos.x);
WRITE_COORD( tr.vecEndPos.y);
WRITE_COORD( tr.vecEndPos.z);
WRITE_SHORT( g_sModelIndexLaser );
WRITE_BYTE( 0 ); // frame start
WRITE_BYTE( 10 ); // framerate
WRITE_BYTE( 5 ); // life
WRITE_BYTE( 100 ); // width
WRITE_BYTE( 120 ); // noise
WRITE_BYTE( 64 ); // r, g, b
WRITE_BYTE( 128 ); // r, g, b
WRITE_BYTE( 255); // r, g, b
WRITE_BYTE( 255 ); // brightness
WRITE_BYTE( 10 ); // speed
MESSAGE_END();
GetAttachment( 0, vecSrc, vecAngles );
CNihilanthHVR *pEntity = (CNihilanthHVR *)Create( "nihilanth_energy_ball", vecSrc, pev->angles, edict() );
pEntity->pev->velocity = Vector ( RANDOM_FLOAT( -0.7, 0.7 ), RANDOM_FLOAT( -0.7, 0.7 ), 1.0 ) * 600.0;
pEntity->GreenBallInit( );
return;
}