private void AimWeapon(WeaponHandler weaponHandler) { if (Input.GetMouseButtonDown(1)) { weaponHandler.Aim(true); } if (Input.GetMouseButtonUp(1)) { weaponHandler.Aim(false); } }
// Handles weapon logic void WeaponLogic() { if (!weaponHandler) { return; } if (Input.GetAxis("Aiming") <= -0.25f || debugAim) { aiming = true; } else { aiming = false; } if (weaponHandler.currentWeapon) { weaponHandler.Aim(aiming); other.requireInputForTurn = !aiming; } weaponHandler.FingerOnTrigger(Input.GetButton(input.fireButton)); /** * if (Input.GetButtonDown(input.dropWeaponButton)) { * weaponHandler.DropCurrentWeapon(); * } */ if (Input.GetButtonDown(input.switchWeaponButton)) { weaponHandler.SwitchWeapons(); } }
private void ZoomInAndOut(WeaponHandler activeWeapon) { if (activeWeapon.weaponAim == WeaponAim.AIM) { // Zoom In if (Input.GetKeyDown(Keycode.MOUSE_RIGHTCLICK)) { FPCameraAnimator.Play(AnimatorTags.ZOOM_IN); crosshair.SetActive(false); } // Zoom Out if (Input.GetKeyUp(Keycode.MOUSE_RIGHTCLICK)) { FPCameraAnimator.Play(AnimatorTags.ZOOM_OUT); crosshair.SetActive(true); } } if (activeWeapon.weaponAim == WeaponAim.SELF_AIM) { // Aim if (Input.GetKeyDown(Keycode.MOUSE_RIGHTCLICK)) { activeWeapon.Aim(true); isAiming = true; } // Un Aim if (Input.GetKeyUp(Keycode.MOUSE_RIGHTCLICK)) { activeWeapon.Aim(false); isAiming = false; } } }
//Handles all weapon logic void WeaponLogic() { if (!weaponHandler) { return; } aiming = Input.GetButton(input.aimButton) || debugAim; weaponHandler.Aim(aiming); other.requireInputForTurn = !aiming; weaponHandler.FingerOnTrigger(Input.GetButton(input.fireButton)); if (Input.GetButtonDown(input.reloadButton)) { weaponHandler.Reload(); } if (Input.GetButtonDown(input.dropWeaponButton)) { weaponHandler.DropCurWeapon(); } if (Input.GetButtonDown(input.switchWeaponButton)) { weaponHandler.SwitchWeapons(); } if (!weaponHandler.currentWeapon) { return; } weaponHandler.currentWeapon.shootRay = new Ray(TPSCamera.transform.position, TPSCamera.transform.forward); }
public void Aim(bool aim) { isAiming = aim; weaponHandler.Aim(aim); }