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

namespace GatherAndDefend.LevelEditor
{
    public class Level : ScriptableObject, IEnumerable<TilemapData>
    {
        private Rect _bounds;
        public Rect Bounds => _bounds;
        [SerializeField]
        private List<TilemapData> _data = new List<TilemapData>();
        [SerializeField]
        private WaveConfig _waveConfig;
        public void SaveFromTilemap(Tilemap tilemap)
        {
            var data = new TilemapData();
            data.SaveFromTilemap(tilemap);
            _data.Add(data);
        }

        [SerializeField]
        private int _startPopulation = 10;
        [SerializeField]
        private int _startFood = 50;
        [SerializeField]
        private int _startWood = 0;
        [SerializeField]
        private int _startRock = 0;
        public int StartPopulation => _startPopulation;
        public int StartFood => _startFood;
        public int StartWood => _startWood;
        public int StartRock => _startRock;


        public WaveConfig WaveConfig { get { return _waveConfig; } }

        public IEnumerator<TilemapData> GetEnumerator()
        {
            return _data.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return _data.GetEnumerator();
        }
    }
}