using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameOverUI : MonoBehaviour {
    public CanvasGroup cg;
    public GameSound gameOverSound;

    public void OnEnable() {
        gameOverSound.Play();
        StartCoroutine(AnimateAlphaIE());
    }

    IEnumerator AnimateAlphaIE() {
        float alpha = 0.0f;
        float speed = 0.5f;

        while(alpha < 1.0f) {
            cg.alpha = alpha;
            alpha += Time.deltaTime * speed;

            yield return null;
        }

        cg.alpha = 1.0f;
    }
}
