using UnityEngine;
using System.Collections.Generic;

public class AppleCategoryProgress : MonoBehaviour {

    public AppleIcon iconPrefab;

    private Color activeColor;
    public Color ActiveColor {
        set { activeColor = value; }
    }

    public void SetupApples(int count) {
        AppleIcon icon;
        for (int i = 0; i < count; i++) {
            icon = Instantiate<AppleIcon>(iconPrefab);
            icon.ActiveColor = activeColor;
            icon.transform.SetParent(this.transform, false);
        }
    }

    public void MarkPickedupApples(int count) {
        int currentId = 0;
        foreach (Transform child in this.transform) {
            AppleIcon icon = child.GetComponent<AppleIcon>();
            if (icon != null) {
                icon.IsPickedUp = currentId < count;
                currentId++;
            }
        }

    }
}
