本文整理汇总了C++中CBaseViewModel::SequenceDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseViewModel::SequenceDuration方法的具体用法?C++ CBaseViewModel::SequenceDuration怎么用?C++ CBaseViewModel::SequenceDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseViewModel
的用法示例。
在下文中一共展示了CBaseViewModel::SequenceDuration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetViewModelSequenceDuration
float CWarsWeapon::GetViewModelSequenceDuration()
{
CBasePlayer *pOwner = ToBasePlayer( GetCommander() );
if ( pOwner == NULL )
{
return BaseClass::GetViewModelSequenceDuration( );
}
CBaseViewModel *vm = pOwner->GetViewModel( m_nViewModelIndex );
if ( vm == NULL )
{
Assert( false );
return 0;
}
SetViewModel();
Assert( vm->ViewModelIndex() == m_nViewModelIndex );
return vm->SequenceDuration();
}
示例2: angVelocity
void CHL2MP_Player::KickAttack(void)
{
if (!IsDead())
{
CBaseViewModel *vm = GetViewModel(1);
if (vm)
{
int idealSequence = vm->SelectWeightedSequence(ACT_VM_PRIMARYATTACK);
if (idealSequence >= 0)
{
vm->SendViewModelMatchingSequence(idealSequence);
m_flNextKickAttack = gpGlobals->curtime + vm->SequenceDuration(idealSequence) - 0.5f;
}
QAngle recoil = QAngle(random->RandomFloat(1.0f, 2.0f), random->RandomFloat(-1.0f, 1.0f), 0);
this->ViewPunch(recoil);
// Trace up or down based on where the enemy is...
// But only if we're basically facing that direction
Vector vecDirection;
int kick_maxrange = 120;
AngleVectors(QAngle(clamp(EyeAngles().x, 20, kick_maxrange), EyeAngles().y, EyeAngles().z), &vecDirection);
CBaseEntity *pEnemy = MyNPCPointer() ? MyNPCPointer()->GetEnemy() : NULL;
if (pEnemy)
{
Vector vecDelta;
VectorSubtract(pEnemy->WorldSpaceCenter(), Weapon_ShootPosition(), vecDelta);
VectorNormalize(vecDelta);
Vector2D vecDelta2D = vecDelta.AsVector2D();
Vector2DNormalize(vecDelta2D);
if (DotProduct2D(vecDelta2D, vecDirection.AsVector2D()) > 0.8f)
{
vecDirection = vecDelta;
}
}
Vector vecEnd;
VectorMA(Weapon_ShootPosition(), 50, vecDirection, vecEnd);
trace_t tr;
UTIL_TraceHull(Weapon_ShootPosition(), vecEnd, Vector(-16, -16, -16), Vector(16, 16, 16), MASK_SHOT_HULL, this, COLLISION_GROUP_NONE, &tr);
// did I hit someone?
float KickDamageMult = 50 + (1 * ((fabs(GetAbsVelocity().x) + fabs(GetAbsVelocity().y) + fabs(GetAbsVelocity().z)) / 48));
float KickThrowForceMult = 20 + (1 * ((fabs(GetAbsVelocity().x) + fabs(GetAbsVelocity().y) + fabs(GetAbsVelocity().z)) / 48));
DevMsg("Kicking at %.2f of damage!\n", KickDamageMult);
DevMsg("Kicking at %.2f of force!\n", KickThrowForceMult);
if (tr.m_pEnt)
{
if (!(tr.m_pEnt))
{
// return;
}
else
{
CBasePropDoor *pDoor = dynamic_cast<CBasePropDoor*>((CBaseEntity*)tr.m_pEnt);
if (pDoor)
{
if (pDoor->HasSpawnFlags(SF_BREAKABLE_BY_PLAYER))
{
AngularImpulse angVelocity(random->RandomFloat(0, 45), 18, random->RandomFloat(-45, 45));
pDoor->PlayBreakOpenSound();
pDoor->BreakDoor(Weapon_ShootPosition(), angVelocity);
return;
}
pDoor->PlayBreakFailSound();
pDoor->KickFail();
return;
}
CBaseEntity *Victim = this->CheckTraceHullAttack(Weapon_ShootPosition(), vecEnd, Vector(-16, -16, -16), Vector(16, 16, 16), KickDamageMult, DMG_CRUSH, KickThrowForceMult, true);
if (Victim)
{
EmitSound("HL2Player.kick_body");
return;
}
}
}
UTIL_TraceLine(Weapon_ShootPosition(), vecEnd, MASK_SHOT_HULL, this, COLLISION_GROUP_NONE, &tr);//IF we hit anything else
if (tr.DidHit())
{
EmitSound("HL2Player.kick_wall");
}
else
{
EmitSound("HL2Player.kick_fire");
}
}
}
}