public void SelectWeaponAction(int selectedWeapon) { if (selectedWeapon == 1 && firstWeapon != null) { objWeapon = Instantiate(firstWeapon.weaponPrefab, weaponPoint); objWeapon.transform.localPosition = firstWeapon.weaponPos; objWeapon.transform.localRotation = Quaternion.Euler(firstWeapon.weaponRot.x, firstWeapon.weaponRot.y, firstWeapon.weaponRot.z); activeShootWeapon = objWeapon.GetComponent <ShootWeapon>(); activeShootWeapon.ammoSlider = ammoSlider; ammoSlider.value = 0; if (activeShootWeapon.sniperCam != null) { characterStatus.sniper = true; sniperCam = activeShootWeapon.sniperCam; } characterIK.rHand.localPosition = firstWeapon.rHandPos; rotRight = Quaternion.Euler(firstWeapon.rHandRot.x, firstWeapon.rHandRot.y, firstWeapon.rHandRot.z); characterIK.rHand.localRotation = rotRight; activeShootWeapon.targetLook = targetLook; activeShootWeapon.cameraMain = cameraSystem; characterInput.shootWeapon = activeShootWeapon; characterIK.lHandTarget = activeShootWeapon.leftHandTarget; characterInput.SetShootDelegate(firstWeapon.type); anim.SetBool("Weapon", true); anim.SetInteger("WeaponType", 2); } if (selectedWeapon == 2 && secondWeapon != null) { objWeapon = Instantiate(secondWeapon.weaponPrefab, weaponPoint); objWeapon.transform.localPosition = secondWeapon.weaponPos; objWeapon.transform.localRotation = Quaternion.Euler(secondWeapon.weaponRot.x, secondWeapon.weaponRot.y, secondWeapon.weaponRot.z); activeShootWeapon = objWeapon.GetComponent <ShootWeapon>(); activeShootWeapon.ammoSlider = ammoSlider; ammoSlider.value = 0; characterIK.rHand.localPosition = secondWeapon.rHandPos; rotRight = Quaternion.Euler(secondWeapon.rHandRot.x, secondWeapon.rHandRot.y, secondWeapon.rHandRot.z); characterIK.rHand.localRotation = rotRight; activeShootWeapon.targetLook = targetLook; activeShootWeapon.cameraMain = cameraSystem; characterInput.shootWeapon = activeShootWeapon; characterIK.lHandTarget = activeShootWeapon.leftHandTarget; characterInput.SetShootDelegate(secondWeapon.type); anim.SetBool("Weapon", true); anim.SetInteger("WeaponType", 1); } if (selectedWeapon == 3) { anim.SetBool("Weapon", true); anim.SetInteger("WeaponType", 0); } }