using UnityEngine;
using System.Collections;

[AddComponentMenu( "Camera-Control/Camera Monkey Follower" )]

public class CameraMonkeyFollower : MonoBehaviour
{
	public float CamOffsetX						= 2.5f;
	public string PlayerName					= "PlayerWater";

	void FixedUpdate ()
	{
		GameObject Monkey = GameObject.Find( PlayerName );

		if ( null != Monkey )
		{
			if ( Monkey.transform.position.x + CamOffsetX > transform.position.x )
			{
				transform.position = new Vector3( Monkey.transform.position.x + CamOffsetX, transform.position.y, transform.position.z );
			}
			/*
			if ( Monkey.transform.position.y + 1 > transform.position.y )
			{
				transform.position = new Vector3( transform.position.x, Monkey.transform.position.y + 1, transform.position.z );
			}

			if ( transform.position.y > Monkey.transform.position.y + 1 && transform.position.y > 2.5f )
			{
				transform.position = new Vector3( transform.position.x, Monkey.transform.position.y + 1, transform.position.z );
			}
			 * */
		}
	}
}
