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

public class AttributeElector
{
    private List<Attributes> mCompleteAttributesList = new List<Attributes>();
    private List<Attributes> mSortedAttributesList;

    public AttributeElector()
    {
        foreach (Attributes att in Enum.GetValues(typeof(Attributes)))
        {
            mCompleteAttributesList.Add(att);
        }
        RefillAndSortAttributesList();
    }

    private void RefillAndSortAttributesList()
    {
        mSortedAttributesList = new List<Attributes>(mCompleteAttributesList);
        mSortedAttributesList.Sort((a, b) => UnityEngine.Random.Range(-1, 2));
    }

    public Attributes GetNextAttribute()
    {
        Attributes att = mSortedAttributesList[0];
        mSortedAttributesList.RemoveAt(0);
        if (mSortedAttributesList.Count == 0)
        {
            RefillAndSortAttributesList();
        }
        return att;
    }
}