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

public class QuestListManager : MonoBehaviour {
    QuestTrackerScript tracker;
    public GameObject questPrefab;
    public RectTransform list;

    List<QuestObjective> objectives = new List<QuestObjective>();
	// Use this for initialization
	void Start () {
        tracker = GameObject.Find("QuestTracker").GetComponent<QuestTrackerScript>();

        foreach (string item in tracker.TODO)
        {
            QuestObjective obj = Instantiate<GameObject>(questPrefab, list).GetComponent<QuestObjective>();
            obj.Init(item);
            objectives.Add(obj);
        }
	}
	
	// Update is called once per frame
	void Update () {
        if (tracker.done.Length > 0)
        {
            for (int i = 0; i < tracker.done.Length; i++)
            {
               if (tracker.done[i]) objectives[i].Check();
            }
        }
		
	}
}
