public void EquipGun(Gun gunToEquip) { // Destroy the currently equipped gun if (equippedGun != null) { Destroy(equippedGun.gameObject); } if (gunToEquip != null) { // Create the new gun and set its parent equippedGun = Instantiate(gunToEquip, weaponHold.position, weaponHold.rotation) as Gun; equippedGun.transform.parent = weaponHold; if (gameObject.name == "Player") { mouseManager.ChangeCrosshair(database.items [equippedGun.GetComponent <ItemObject> ().databaseID].crosshair); mouseManager.ChangeMouse(true, false); gunManager.ammoUI.Display(true); gunManager.ammoUI.SetMaxAmmo(gunToEquip.clipSize); gunManager.ammoUI.SetCurrentAmmo(0); } } else { mouseManager.ChangeMouse(false, true); gunManager.ammoUI.Display(false); } }