How to set limitations on rotateAround in C#?

So here’s the long and short of it. I managed to get the camera to rotate around something. However, I want to set boundaries on how far it can go left or right. The problem, however, is that it seems to have nothing that will actually be able to measure how far it goes around the object. I know I could likely set restrictions on the x,y, and z of the position and the y of the rotation (Those are the 4 things it seems to change when I rotate it) but I don’t know how to access, much less put restrictions on those either. Here’s the working code for the rotation:

`public class RotateCam : MonoBehaviour {

public static bool GreaterThen;
public static bool LessThen;

void Start(){

	GreaterThen = false;
	LessThen = false;

void Update () {
	if (GreaterThen == false) {
		if (Input.GetKeyDown (KeyCode.LeftArrow)) {
			transform.RotateAround (, Vector3.up, 300 * Time.deltaTime);

	if(LessThen == false){
		if (Input.GetKeyDown (KeyCode.RightArrow)) {
			transform.RotateAround (, Vector3.down, 300 * Time.deltaTime * 2);



Don’t mind the bools, they were a failed attempt at what I need help with.

please help.

I couldn’t get the image to work in comments. You could use the direction where the target object is facing as a reference for when you can rotate or not.