using UnityEngine;
using System.Collections;




public class FollowSubMArine : MonoBehaviour
{
    public Transform submarine;
    public Boundary boundarycam;
    // Use this for initialization
    void Start () {
	
	}

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

        GameObject lvl1 = GameObject.Find("LVL1(Clone)");
        GameObject lvl2 = GameObject.Find("LVL2(Clone)");
        GameObject lvl3 = GameObject.Find("LVL3(Clone)");



        if (submarine != null)
        {

            if(lvl1!=null)
            {
                transform.position = (49.0f * transform.position + submarine.position - Vector3.left * 400.0f + Vector3.forward * 250.0f) / 50.0f;
            }


            if(lvl2!=null)
            {
                transform.position = (49.0f * transform.position + submarine.position - Vector3.left * 400.0f ) / 50.0f;
            }


            if (lvl3 != null)
            {
                transform.position = (49.0f * transform.position + submarine.position - Vector3.left * 400.0f + Vector3.forward * 250.0f) / 50.0f;
            }


        }
    }
}
