本文整理汇总了C++中EHANDLE::Touch方法的典型用法代码示例。如果您正苦于以下问题:C++ EHANDLE::Touch方法的具体用法?C++ EHANDLE::Touch怎么用?C++ EHANDLE::Touch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EHANDLE
的用法示例。
在下文中一共展示了EHANDLE::Touch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TeleportThink
void CNihilanthHVR :: TeleportThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
// check world boundaries
if (m_hEnemy == NULL || !m_hEnemy->IsAlive() || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096)
{
STOP_SOUND(edict(), CHAN_WEAPON, "x/x_teleattack1.wav" );
UTIL_Remove( this );
return;
}
if ((m_hEnemy->Center() - pev->origin).Length() < 128)
{
STOP_SOUND(edict(), CHAN_WEAPON, "x/x_teleattack1.wav" );
UTIL_Remove( this );
if (m_hTargetEnt != NULL)
m_hTargetEnt->Use( m_hEnemy, m_hEnemy, USE_ON, 1.0 );
if ( m_hTouch != NULL && m_hEnemy != NULL )
m_hTouch->Touch( m_hEnemy );
}
else
{
MovetoTarget( m_hEnemy->Center( ) );
}
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_ELIGHT );
WRITE_SHORT( entindex( ) ); // entity, attachment
WRITE_COORD( pev->origin.x ); // origin
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z );
WRITE_COORD( 256 ); // radius
WRITE_BYTE( 0 ); // R
WRITE_BYTE( 255 ); // G
WRITE_BYTE( 0 ); // B
WRITE_BYTE( 10 ); // life * 10
WRITE_COORD( 256 ); // decay
MESSAGE_END();
pev->frame = (int)(pev->frame + 1) % 20;
}
示例2: TeleportTouch
void CNihilanthHVR::TeleportTouch( CBaseEntity *pOther )
{
CBaseEntity *pEnemy = m_hEnemy;
if (pOther == pEnemy)
{
if (m_hTargetEnt != NULL)
m_hTargetEnt->Use( pEnemy, pEnemy, USE_ON, 1.0 );
if (m_hTouch != NULL && pEnemy != NULL )
m_hTouch->Touch( pEnemy );
}
else
{
m_pNihilanth->MakeFriend( pev->origin );
}
SetTouch( NULL );
STOP_SOUND(edict(), CHAN_WEAPON, "x/x_teleattack1.wav" );
UTIL_Remove( this );
}