using UnityEngine;
using System.Collections;

public class CameraController : MonoBehaviour {
	
	public GameObject[] objectsToFollow;

	public float paddingX;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		Vector3 p = gameObject.transform.position;
		Vector3 avg = Vector3.zero;
		for(int i = 0; i < objectsToFollow.Length; i++)
		{
			avg += objectsToFollow[i].transform.position;
		}	
		gameObject.transform.position = new Vector3(avg.x / objectsToFollow.Length + paddingX, p.y, p.z);
	
	}
}
