using UnityEngine;
using System.Collections;

public class MeetLady : MonoBehaviour {
    private bool triggered = false;
    private float untrigger = 0.0f;
    private float delay = 3.0f;

    AudioSource audio;

    public Animator anim;
    // Use this for initialization
    void Start() {
        audio = GetComponent<AudioSource>();
    }

    // Update is called once per frame
    void Update() {
        if (untrigger > 0) {
            untrigger -= Time.deltaTime;
            if (untrigger <= 0) {
                ScreenFader.instance.changeLevel("Dream2");
            }
        }
    }

    void OnTriggerEnter(Collider other) {
        if (other.tag == "Player" && !triggered) {
            CameraFollow cf = FindObjectOfType<CameraFollow>();
            cf.startZoom(this.transform);
            triggered = true;
            untrigger = delay;
            anim.SetTrigger("lady");
            audio.Play();
            

        }
    }
}
