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

public class TorchAnimator : MonoBehaviour
{
    private new Light light;
    private Color initialColor; 

    public void Start()
    {
        this.light = this.GetComponentInChildren<Light>();
        this.initialColor = this.light.color;
        StartCoroutine(LightCoroutine()); 
    }

    private IEnumerator LightCoroutine()
    {
        while(true)
        {
            yield return new WaitForSeconds(Random.Range(0.25f, 0.75f));
            light.color = new Color(initialColor.r + Random.Range(-0.1f, 0.1f), initialColor.g, initialColor.b); 
        }
    }

}
