using UnityEngine;
using System.Collections;

public class TrainSoundScript : MonoBehaviour {

	public bool followPlayer = true;
	private GameObject thePlayer;

	// Use this for initialization
	void Start () {
	
		if(followPlayer){

			thePlayer = GameObject.FindGameObjectWithTag("Player");

			if(!thePlayer){
				Debug.LogError("Player not found!");
			}

		}

	}
	
	// Update is called once per frame
	void Update () {
	
		if(followPlayer){
			transform.position = thePlayer.transform.position;
		}

	}

}
