using UnityEngine;
using System.Collections;

namespace UnityStandardAssets._2D
{
	public class CamaraMia : MonoBehaviour {
		public GameObject personaje;
		private PlatformerCharacter2D scriptPersonaje;
		//float ny = 0.9f;
		// Use this for initialization
		void Start () {
			personaje = GameObject.FindGameObjectWithTag ("jugadorGGJ");
			scriptPersonaje = personaje.GetComponent<PlatformerCharacter2D> ();
		}

		// Update is called once per frame
		void Update () {			
			float nx = Mathf.Lerp (this.transform.position.x,personaje.transform.position.x,0.05f);
			//float factorY = scriptPersonaje.getEstaEnElPiso ()?0.05f:0.002f;
			//Mathf.Lerp (this.transform.position.y,personaje.transform.position.y+1f,0.01f);
			this.transform.position = new Vector3(nx,transform.position.y,-10f);
			Debug.Log (personaje);
		}

		public void cambiarPos(Transform t){
			//Debug.Log ("la camara belleza");
			float ny = t.position.y + 0.9f;
			float nx = t.position.x;
			this.transform.position = new Vector3(nx,ny,-10f);
		}
	}
}