using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class PrisonerAnim : MonoBehaviour
{
	[SerializeField]
	Vector3 moveVec = new Vector3 (1f, 0f, 0f);
	[SerializeField]
	Vector3 startPos = new Vector3 (-600f, 0f, 0f);
	[SerializeField]
	Vector3 middlePos = new Vector3 ( 150f, 0f, 0f);
	[SerializeField]
	Vector3 endPos = new Vector3 (900f, 0f, 0f);

	private float xpos;

	private RectTransform rt;

	void Awake() {
		rt = GetComponent<RectTransform> ();
		Invoke ("Move2Center", .5f);
	}

	void Start () {
		rt.transform.localPosition = startPos;
	}

	void Move2Center (){
		LeanTween.move (rt, middlePos, .2f).setEase(LeanTweenType.easeInOutQuad);
		Invoke ("Move2End", 1f);
	}

	void Move2End () {
		LeanTween.move (rt, endPos, .2f).setEase(LeanTweenType.easeInOutQuad);
	}

	void FixedUpdate() {
		rt.position += moveVec;
	}
}
