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

public class CreditsManager : MonoBehaviour
{

    public Text CreditsText;
    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (GetComponent<CanvasGroup>().alpha == 1 && Input.GetMouseButtonDown(0))
        {
            Close();
        }
    }

    void OnFadeOut()
    {
        gameObject.SetActive(false);
        CreditsText.gameObject.SetActive(false);
    }

    void OnFadeIn()
    {
        CreditsText.gameObject.SetActive(true);
    }

    void Close()
    {
        GetComponent<Animator>().Play("FADE_OUT");
    }



    internal void Open()
    {
        gameObject.SetActive(true);
        GetComponent<Animator>().SetFloat("Speed", 2.0f);
        GetComponent<Animator>().Play("FADE_IN");
    }
}
