main camera problem in jump from object to another?

I am building a game that have some objects …

Unity3D:i need Focus In On Object With Camera During Gameplay.and I need the camera to jump from one target to another.
ex:i need if i press on a specific key in the keyboard the camera zooms in a specific object in my scene and if i press on another key the camera jump from first object to another .
this is my code the code doesn’t have any compiler error camera focus correctly but i have problem in camera jump from object to another .

using UnityEngine;
using System.Collections;
public class animatecamera : MonoBehaviour {

	public float moveSpeed = 20f;
	public GameObject targetObject;
	public GameObject targetObject3;
	public GameObject targetObject4;
	public GameObject targetObject5;
	public GameObject targetObject6;
    private bool movingTowardsTarget=false;
	private bool movingTowardsTarget3=false;
	private bool movingTowardsTarget4=false;
	private bool movingTowardsTarget5=false;
	private bool movingTowardsTarget6=false;
	private float lerpSpeed = 0.025f;
	private Transform toRot;
	private Transform fromRot;
	private bool inPosition=false;


	// Use this for initialization
	void Start () {
}

	// Update is called once per frame
	void Update () {

///first Target condition
if (Input.GetKeyDown(“m”))
{
if (movingTowardsTarget == true)
{
movingTowardsTarget = false;
}
else
{
fromRot = gameObject.transform;
toRot = targetObject.transform;
movingTowardsTarget = true;

			}


		}
		if(movingTowardsTarget)
		{
			MoveTowardsTarget (targetObject);
		}


		//Target3 condition
		if (Input.GetKeyDown("p"))
		{
			if (movingTowardsTarget3 == true)
			{
				movingTowardsTarget3 = false;
			} 
			else
			{
				 fromRot = gameObject.transform;
 				 toRot = targetObject3.transform;
				movingTowardsTarget3 = true;
			}

		}
		if(movingTowardsTarget3)
		{
			MoveTowardsTarget3 (targetObject3);
		}
		//Target4 condition 
		if (Input.GetKeyDown("t"))
		{
			if (movingTowardsTarget4 == true)
			{
				movingTowardsTarget4= false;
			} 
			else
			{
				fromRot = gameObject.transform;
				toRot = targetObject4.transform;

				movingTowardsTarget4 = true;
			}

		}
		if(movingTowardsTarget4)
		{
			MoveTowardsTarget4 (targetObject4);
		}


		//Target5 condition
		if (Input.GetKeyDown("k"))
		{
			if (movingTowardsTarget5 == true)
			{
				movingTowardsTarget5= false;
			} 
			else
			{
				fromRot = gameObject.transform;
				toRot = targetObject5.transform;

				movingTowardsTarget5 = true;
			}


		}
		if(movingTowardsTarget5)
		{
			MoveTowardsTarget5 (targetObject5);
		}
		//Target6  condition 
		if (Input.GetKeyDown("["))
		{
			if (movingTowardsTarget6 == true)
			{
				movingTowardsTarget6 = false;
			} 
			else
			{
				fromRot = gameObject.transform;
				toRot = targetObject6.transform;

				movingTowardsTarget6 = true;
			}

		}
		if(movingTowardsTarget6)
		{
			MoveTowardsTarget6 (targetObject6);
		}
	}
	
	public void MoveTowardsTarget (GameObject target)
	{
		transform.position =Vector3.MoveTowards(transform.position,target.transform.position, moveSpeed* Time.deltaTime);
		if (Vector3.Distance (transform.position, target.transform.position) < 0.1) 
		{
			GetComponent<Camera>().transform.position = target.transform.position;
		//transform.position = target.transform.position;

			inPosition = true;
			}
		if (inPosition) 
		{
			if (Mathf.Abs ((fromRot.localEulerAngles.y) - (toRot.localEulerAngles.y)) < 3)
			{
				//reset
				GetComponent<Camera>().transform.rotation=target.transform.rotation;
			//	transform.rotation=target.transform.rotation;

				movingTowardsTarget = false;
				inPosition = false;
				}

			else 
			{
				transform.rotation = Quaternion.Lerp (fromRot.rotation, toRot.rotation, Time.time * lerpSpeed);
			}
		}

	}


	//	// fun MoveTowards hourse obj

	public void MoveTowardsTarget3 (GameObject target3)
	{
		transform.position =Vector3.MoveTowards(transform.position,target3.transform.position, moveSpeed* Time.deltaTime);
		if (Vector3.Distance (transform.position, target3.transform.position) < 0.1) 
		{
			GetComponent<Camera>().transform.position = target3.transform.position;
			//transform.position = target3.transform.position;

			inPosition = true;
		}
		if (inPosition) 
		{
			if (Mathf.Abs ((fromRot.localEulerAngles.y) - (toRot.localEulerAngles.y)) < 3)
			{
				//reset
				GetComponent<Camera>().transform.rotation=target3.transform.rotation;
				movingTowardsTarget3 = false;
				inPosition = false;
			}

			else 
			{
				transform.rotation = Quaternion.Lerp (fromRot.rotation, toRot.rotation, Time.time * lerpSpeed);
			}
		}

	}
//	//elephant fun

	public void MoveTowardsTarget4 (GameObject target4)
	{
		transform.position =Vector3.MoveTowards(transform.position,target4.transform.position, moveSpeed* Time.deltaTime);
		if (Vector3.Distance (transform.position, target4.transform.position) < 0.1) 
		{
			GetComponent<Camera>().transform.position = target4.transform.position;

			inPosition = true;
		}
		if (inPosition) 
		{
			if (Mathf.Abs ((fromRot.localEulerAngles.y) - (toRot.localEulerAngles.y)) < 3)
			{
				//reset
				GetComponent<Camera>().transform.rotation=target4.transform.rotation;
				movingTowardsTarget4 = false;
				inPosition = false;
			}

			else 
			{
				 transform.rotation = Quaternion.Lerp (fromRot.rotation, toRot.rotation, Time.time * lerpSpeed);
			}
		}

	}
	//rabbit fun

	public void MoveTowardsTarget5 (GameObject target5)
	{
		transform.position =Vector3.MoveTowards( transform.position,target5.transform.position, moveSpeed* Time.deltaTime);
		if (Vector3.Distance (transform.position, target5.transform.position) < 0.1) 
		{
			GetComponent<Camera>().transform.position = target5.transform.position;
       			inPosition = true;
		}
		if (inPosition) 
		{
			if (Mathf.Abs ((fromRot.localEulerAngles.y) - (toRot.localEulerAngles.y)) < 3)
			{
				//reset
				GetComponent<Camera>().transform.rotation=target5.transform.rotation;
				movingTowardsTarget5 = false;
				inPosition = false;
			}

			else 
			{
				transform.rotation = Quaternion.Lerp (fromRot.rotation, toRot.rotation, Time.time * lerpSpeed);
			}
		}

	}
	//camal fun
	public void MoveTowardsTarget6 (GameObject target6)
	{
		transform.position =Vector3.MoveTowards(transform.position,target6.transform.position, moveSpeed* Time.deltaTime);
		if (Vector3.Distance (transform.position, target6.transform.position) < 0.1) 
		{
			GetComponent<Camera>().transform.position = target6.transform.position;
			inPosition = true;
		}
		if (inPosition) 
		{
			if (Mathf.Abs ((fromRot.localEulerAngles.y) - (toRot.localEulerAngles.y)) < 3)
			{
				//reset

				GetComponent<Camera>().transform.rotation=target6.transform.rotation;
			
				movingTowardsTarget6 = false;
				inPosition = false;
			}

			else 
			{
				transform.rotation = Quaternion.Lerp (fromRot.rotation, toRot.rotation, Time.time * lerpSpeed);
			}
		}

	}
}

You need to study arrays and loops and how they work. otherwise scripts like what you are doing are very difficult. here is a little example to show how to move a camera in front of objects. make 4 new game objects in your scene and name them “marker0” “marker1” “marker2” and “marker3”.

i assigned the keys “a” “b” “c” and “d” to go to them.
the camera will move in front of the objects named marker.

im not sure exactly what you are trying to do but this is an example of how much easier it is with arrays and loops

	public string[] keys;
	GameObject[] g;
	int index;
	int i;
	void Start () {
		keys="a,b,c,d".Split(new char[] {','});
		i = 4;
		g=new GameObject[4];
		while (i>0) {i--;g  *= GameObject.Find ("marker" + i);}}*

void Update () {

  •  i = keys.Length;*
    
  •  while(i>0){i--;;*
    

_ if(Input.GetKeyDown(keys*)){index=i;}}_
_
transform.position = Vector3.MoveTowards (transform.position,_
_ g[index].transform.position-transform.forward2, Time.deltaTime*5);}_

Instead of having the camera change what object it follows.
create an object that the camera always follows, then move that
object around when needed.

This will make things a lot easier if you plan to use things like
the MultiPurposeCameraRig from the built-in cameras package.
Assets->Import Package->Cameras