public bool TakeBullets( BulletType bulletType, int count )
{
bool taked = false;
for( int n = 0; n < weapons.Count; n++ )
{
GunType gunType = Type.Weapons[ n ].WeaponType as GunType;
if( gunType == null )
continue;
if( gunType.NormalMode.BulletType == bulletType )
{
if( weapons[ n ].normalBulletCount < gunType.NormalMode.BulletCapacity )
{
taked = true;
weapons[ n ].normalBulletCount += count;
if( weapons[ n ].normalBulletCount > gunType.NormalMode.BulletCapacity )
weapons[ n ].normalBulletCount = gunType.NormalMode.BulletCapacity;
}
}
if( gunType.AlternativeMode.BulletType == bulletType )
{
if( weapons[ n ].alternativeBulletCount < gunType.AlternativeMode.BulletCapacity )
{
taked = true;
weapons[ n ].alternativeBulletCount += count;
if( weapons[ n ].alternativeBulletCount > gunType.AlternativeMode.BulletCapacity )
weapons[ n ].alternativeBulletCount = gunType.AlternativeMode.BulletCapacity;
}
}
}
if( ActiveWeapon != null )
{
Gun activeGun = activeWeapon as Gun;
if( activeGun != null )
activeGun.AddBullets( bulletType, count );
}
return taked;
}