Half Life 2 source code
登录 | 论坛导航 -> 华新鲜事 -> 技术の宅 | 本帖共有 13 楼,当前显示第 4 楼 : 从楼主开始阅读 : 本帖树形列表 : 返回上一页
作者:SmellsLikeTeenSpirit (等级:11 - 出神入化,发帖:6371) 发表:2003-10-06 03:26:09  4楼 
找了很久了! 终于... 我们看看source code 吧
看看AK47的各项系数


void CAK47::Spawn()
{
CCSBaseGunInfo info;

info.m_flAccuracyDivisor = 200;
info.m_flAccuracyOffset = 0.35;
info.m_flMaxInaccuracy = 1.25;

info.m_iPenetration = 2;
info.m_iDamage = 36;
info.m_flRangeModifier = 0.98;

info.m_flTimeToIdleAfterFire = 1.9;
info.m_flIdleInterval = 20;

CSBaseGunSpawn( &info );
}


void CAK47::AK47Fire( float flSpread, float flCycleTime )
{
if ( !CSBaseGunFire( flSpread, flCycleTime ) )
return;

CCSPlayer *pPlayer = GetPlayerOwner();

if (pPlayer->GetAbsVelocity().Length2D() > 0 )
KickBack ( 1.5, 0.45, 0.225, 0.05, 6.5, 2.5, 7 );
else if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
KickBack ( 2, 1.0, 0.5, 0.35, 9, 6, 5 );
else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
KickBack ( 0.9, 0.35, 0.15, 0.025, 5.5, 1.5, 9 );
else
KickBack ( 1, 0.375, 0.175, 0.0375, 5.75, 1.75, 8 );
}


void CAK47::PrimaryAttack()
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( !pPlayer )
Error( "CAK47::PrimaryAttack - !pPlayer" );

if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
AK47Fire( 0.04 + (0.4) * m_flAccuracy, 0.0955 );
else if (pPlayer->GetAbsVelocity().Length2D() > 140)
AK47Fire( 0.04 + (0.07) * m_flAccuracy, 0.0955 );
else
AK47Fire( (0.0275) * m_flAccuracy, 0.0955 );
}
War is peace.
Freedom is slavery.
Ignorance is strength.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版只看此人从这里展开收起列表

本帖共有 13 楼,当前显示第 4 楼,本文还有 N-1 层楼,要不你试试看:点击此处阅读更多 >>



请登录后回复:帐号   密码