private void ThrowWeapon()
 {
     groundWeaponScript = Instantiate(weaponScript.groundWeapon,
                                      attachedWeapon.transform.position,
                                      attachedWeapon.transform.rotation)
                          .GetComponent <GroundWeaponScript>();
     groundWeaponScript.hasBeenThrown = true;
     groundWeaponScript.previousAmmos = weaponScript.ammoNumber;
     Destroy(attachedWeapon);
     attachedWeapon = null;
     weaponScript   = null;
 }
    private void PickupWeapon(GameObject groundWeapon)
    {
        groundWeaponScript = groundWeapon.GetComponent <GroundWeaponScript>();

        attachedWeapon = Instantiate(groundWeaponScript.attachedWeapon, weaponContainer.transform);
        attachedWeapon.transform.position = weaponContainer.transform.position;
        attachedWeapon.transform.rotation = weaponContainer.transform.rotation;

        weaponScript = attachedWeapon.GetComponent <WeaponScript>();
        weaponScript.isOwnedByPlayer = true;

        // Check if the player already used some bullets
        weaponScript.ammoNumber = groundWeaponScript.previousAmmos > -1 ?
                                  groundWeaponScript.previousAmmos
            : weaponScript.ammoNumber;

        Destroy(groundWeapon);
        PlaySound(pickupWeaponSound);
    }