本文整理汇总了C++中CBaseCombatCharacter::DispatchInteraction方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseCombatCharacter::DispatchInteraction方法的具体用法?C++ CBaseCombatCharacter::DispatchInteraction怎么用?C++ CBaseCombatCharacter::DispatchInteraction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseCombatCharacter
的用法示例。
在下文中一共展示了CBaseCombatCharacter::DispatchInteraction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnsnareVictim
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CNPC_Ichthyosaur::EnsnareVictim( CBaseEntity *pVictim )
{
CBaseCombatCharacter* pBCC = (CBaseCombatCharacter *) pVictim;
if ( pBCC && pBCC->DispatchInteraction( g_interactionBarnacleVictimGrab, NULL, this ) )
{
if ( pVictim->IsPlayer() )
{
CBasePlayer *pPlayer = dynamic_cast< CBasePlayer * >((CBaseEntity *) pVictim);
if ( pPlayer )
{
m_flHoldTime = MAX( gpGlobals->curtime+3.0f, pPlayer->PlayerDrownTime() - 2.0f );
}
}
else
{
m_flHoldTime = gpGlobals->curtime + 4.0f;
}
m_pVictim = pVictim;
m_pVictim->AddSolidFlags( FSOLID_NOT_SOLID );
SetSchedule( SCHED_ICH_DROWN_VICTIM );
}
}
示例2: ReleaseVictim
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CNPC_Ichthyosaur::ReleaseVictim( void )
{
CBaseCombatCharacter *pBCC = (CBaseCombatCharacter *) m_pVictim;
pBCC->DispatchInteraction( g_interactionBarnacleVictimReleased, NULL, this );
m_pVictim->RemoveSolidFlags( FSOLID_NOT_SOLID );
m_pVictim = NULL;
m_flNextBiteTime = gpGlobals->curtime + 8.0f;
m_flHoldTime = gpGlobals->curtime - 0.1f;
}
示例3: HandleAnimEvent
//.........这里部分代码省略.........
if ( pHurt )
{
Vector forward, up;
AngleVectors( GetAbsAngles(), &forward, NULL, &up );
pHurt->ApplyAbsVelocityImpulse( 100 * (up-forward) );
pHurt->SetGroundEntity( NULL );
}
}
break;
case BSQUID_AE_WHIP_SND:
{
EmitSound( "NPC_Bullsquid.TailWhip" );
break;
}
/*
case BSQUID_AE_TAILWHIP:
{
CBaseEntity *pHurt = CheckTraceHullAttack( 70, Vector(-16,-16,-16), Vector(16,16,16), sk_bullsquid_dmg_whip.GetFloat(), DMG_SLASH | DMG_ALWAYSGIB );
if ( pHurt )
{
Vector right, up;
AngleVectors( GetAbsAngles(), NULL, &right, &up );
if ( pHurt->GetFlags() & ( FL_NPC | FL_CLIENT ) )
pHurt->ViewPunch( QAngle( 20, 0, -20 ) );
pHurt->ApplyAbsVelocityImpulse( 100 * (up+2*right) );
}
}
break;
*/
case BSQUID_AE_BLINK:
{
// close eye.
m_nSkin = 1;
}
break;
case BSQUID_AE_HOP:
{
float flGravity = GetCurrentGravity();
// throw the squid up into the air on this frame.
if ( GetFlags() & FL_ONGROUND )
{
SetGroundEntity( NULL );
}
// jump 40 inches into the air
Vector vecVel = GetAbsVelocity();
vecVel.z += sqrt( flGravity * 2.0 * 40 );
SetAbsVelocity( vecVel );
}
break;
case BSQUID_AE_THROW:
{
// squid throws its prey IF the prey is a client.
CBaseEntity *pHurt = CheckTraceHullAttack( 70, Vector(-16,-16,-16), Vector(16,16,16), 0, 0 );
if ( pHurt )
{
pHurt->ViewPunch( QAngle(20,0,-20) );
// screeshake transforms the viewmodel as well as the viewangle. No problems with seeing the ends of the viewmodels.
UTIL_ScreenShake( pHurt->GetAbsOrigin(), 25.0, 1.5, 0.7, 2, SHAKE_START );
// If the player, throw him around
if ( pHurt->IsPlayer())
{
Vector forward, up;
AngleVectors( GetLocalAngles(), &forward, NULL, &up );
pHurt->ApplyAbsVelocityImpulse( forward * 300 + up * 300 );
}
// If not the player see if has bullsquid throw interatcion
else
{
CBaseCombatCharacter *pVictim = ToBaseCombatCharacter( pHurt );
if (pVictim)
{
if ( pVictim->DispatchInteraction( g_interactionBullsquidThrow, NULL, this ) )
{
Vector forward, up;
AngleVectors( GetLocalAngles(), &forward, NULL, &up );
pVictim->ApplyAbsVelocityImpulse( forward * 300 + up * 250 );
}
}
}
}
}
break;
default:
BaseClass::HandleAnimEvent( pEvent );
}
}