using UnityEngine;
using System.Collections;

public class CameraFollow : MonoBehaviour
{

    public GameObject player;       //Public variable to store a reference to the player game object
    public Vector3 offset;

    // Use this for initialization
    void Start()
    {

    }

    // LateUpdate is called after Update each frame
    void LateUpdate()
    {
        Vector3 newPos = player.transform.position;
        newPos.x = 0;
        newPos.z = this.transform.position.z;

        newPos = newPos + offset;

        //Hooray!
        this.transform.position = newPos;
    }
}