using UnityEngine;
using System.Collections;

public class ZoomTrigger : MonoBehaviour {

    private bool triggered = false;
    private float untrigger = 0.0f;
    private float delay = 2.0f;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
        if (untrigger > 0) {
            untrigger -= Time.deltaTime;
            if (untrigger <= 0) {
                CameraFollow cf = FindObjectOfType<CameraFollow>();
                cf.zoomOut();
            }
        }
	}

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