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

public class FadeToLight : MonoBehaviour {

    public float fadeTime;
    float currentTime;

    public GameObject flames;

    bool makeFade;

    SpriteRenderer s;

	// Use this for initialization
	void Start () {
        makeFade = StaticStore.FirstStart;
        currentTime = 0;
        s = GetComponent<SpriteRenderer>();

        if (!makeFade)
        {
            s.enabled = false;
        }

        StaticStore.FirstStart = false;
    }
	
	// Update is called once per frame
	void Update () {
        currentTime += Time.deltaTime;

        if (makeFade)
        {
            s.color = new Color(0, 0, 0, (fadeTime - currentTime) / fadeTime);
        }

        if (currentTime >= fadeTime)
        {
            flames.SetActive(true);
            Destroy(gameObject);
        }

	}
}
