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

public class LightController : MonoBehaviour {


    GameObject[] lights;
    public float MaxLightOrbit = 6f;
    public float MinLightOrbit = 1f;
    float pitchValue = 1f;

    public bool isReset=false;

	private void Start()
	{
        lights = GameObject.FindGameObjectsWithTag("LightAttack");
	}

    public void IncreaseLightOrbit()
    {
        isReset = false;
        foreach (var light in lights)
        {
            if (light.GetComponent<LightAttractor>().radius < MaxLightOrbit)
            {
                Debug.Log("Test");

                light.GetComponent<LightAttractor>().radius += 1f;

            }
        }
    }

    public void DecreaseLightOrbit()
    {
        foreach (var light in lights)
        {
            if (light.GetComponent<LightAttractor>().radius > MinLightOrbit)
            {
                light.GetComponent<LightAttractor>().radius -= 1f;
                if (light.GetComponent<LightAttractor>().radius < 1.5)
                {
                    
                }
            
            }
        }
    }

	public void Reset()
	{
        isReset = true;
	}

	private void Update()
	{
        if (isReset)
        {          
            DecreaseLightOrbit();
        }
    }




}
