using UnityEngine;
using System.Collections;

public class DreamManager : MonoBehaviour {

    public string nextLevel = "Level1";
    public int frames = 3;

    public float speed = 1000.0f;

    public RectTransform slides;

    public int offSetPerSlide = 1000;

    private int current = 0;
    private float startx; 


    public void next() {
        current++;
        if (current >= frames) {
            ScreenFader.instance.changeLevel(nextLevel);
        }
    }

	// Use this for initialization
    void Start() {
        startx = slides.anchoredPosition.x;
	}
	
	// Update is called once per frame
	void Update () {
        if (slides.anchoredPosition.x > startx - offSetPerSlide * current) {
            slides.anchoredPosition = new Vector2(slides.anchoredPosition.x - Time.deltaTime * speed, slides.anchoredPosition.y);
        } 


	
	}
}
