private void RotateBaseIfValid(float angleChange) { var eulerAngles = _CannonBase.rotation.eulerAngles; float newAngle = (eulerAngles.y + angleChange); if (Angles.IsWithinDegreeLimits(newAngle, _BaseYawMinDegrees, _BaseYawMaxDegrees)) { _CannonBase.Rotate(Vector3.up, angleChange); } }
private void RotateTurretIfValid(float angleChange) { if (_IsReady) { var eulerAngles = _TurretBase.rotation.eulerAngles; float newAngle = (eulerAngles.x + angleChange); if ( Angles.IsWithinDegreeLimits( newAngle, _TurretPitchMinDegrees, _TurretPitchMaxDegrees )) { _TurretBase.Rotate(Vector3.right, angleChange); } } }