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

public class BallColorController : MonoBehaviour
{
    public GameObject[] ballColor;
    public PlantsController plantController;
    FlowerNeeds ActualNeeds;
    int lvl = -1;

    private void Start()
    {
        


        foreach (GameObject go in ballColor)
        {
            go.SetActive(false);
        }
    }

    private void Update()
    {
        ActualNeeds = plantController.ActualNeeds;

        if (lvl != plantController.m_Lvl)
        {
            lvl = plantController.m_Lvl;

            
            int qtty = 0;

            foreach (FlowerColors fn in ActualNeeds.myColors)
            {
                for (int i = 0; i <= fn.qtty - 1; i++)
                {
                    ballColor[qtty].SetActive(true);
                    ballColor[qtty].GetComponent<SpriteRenderer>().color = fn.color;
                    qtty++;
                }

            }



        }
    }


}
