using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraControl : MonoBehaviour {
    Camera _mainCamera;
    public GameObject _player1, _player2;
	// Use this for initialization
	void Start () {
        _mainCamera = Camera.main;

    }
	
	// Update is called once per frame
	void Update () {
        float xPosition = (_player1.transform.position.x + _player2.transform.position.x) / 2;
        _mainCamera.transform.position = new Vector3(xPosition, _mainCamera.transform.position.y, _mainCamera.transform.position.z);
    }
}
