Exemplo n.º 1
0
    /// <summary>
    /// Loads as much ammo as possible from the given clip. Returns reloading message.
    /// </summary>
    public String LoadFromClip(MagazineBehaviour clip)
    {
        if (clip == null)
        {
            return("");
        }
        int toTransfer = Math.Min(magazineSize - serverAmmoRemains, clip.serverAmmoRemains);

        clip.ExpendAmmo(toTransfer);
        ServerSetAmmoRemains(serverAmmoRemains + toTransfer);

        return("Loaded " + toTransfer + (toTransfer == 1 ? " piece" : " pieces") + " of ammunition.");
    }
Exemplo n.º 2
0
    /// <summary>
    /// Loads as much ammo as possible from the given clip. Returns reloading message.
    /// </summary>
    public String LoadFromClip(MagazineBehaviour clip)
    {
        if (clip == null)
        {
            return("");
        }

        int toTransfer = Math.Min(magazineSize - serverAmmoRemains, clip.serverAmmoRemains);

        clip.ExpendAmmo(toTransfer);
        if (magType == MagType.Standard)
        {
            for (int i = toTransfer; i != 0; i--)
            {
                containedBullets.Add(clip.initalProjectile);
                containedProjectilesFired.Add(clip.ProjectilesFired);
            }
        }
        ServerSetAmmoRemains(serverAmmoRemains + toTransfer);

        return("Loaded " + toTransfer + (toTransfer == 1 ? " piece" : " pieces") + " of ammunition.");
    }
Exemplo n.º 3
0
    /// <summary>
    /// Loads as much ammo as possible from the given clip. Returns reloading message.
    /// </summary>
    public String LoadFromClip(MagazineBehaviour clip)
    {
        if (clip == null)
        {
            return("");
        }

        int toTransfer = Math.Min(magazineSize - serverAmmoRemains, clip.serverAmmoRemains);

        clip.ExpendAmmo(toTransfer);
        if (!isClip && !isCell)
        {
            for (int i = toTransfer; i != 0; i--)
            {
                containedBullets.Add(clip.Projectile);
                containedProjectilesFired.Add(clip.ProjectilesFired);
            }
            UpdateProjectile();                 //sets the projectile that will be fired next
            //this is here in the case that we had no ammo loaded, so the 0th entry was changed
        }
        ServerSetAmmoRemains(serverAmmoRemains + toTransfer);

        return("Loaded " + toTransfer + (toTransfer == 1 ? " piece" : " pieces") + " of ammunition.");
    }