using System;
using UnityEngine;

[CreateAssetMenu(fileName = "Faction provider", menuName = "Faction provider")]
public sealed class FactionProvider : ScriptableObject
{
    public Faction[] Factions => GetFactions();
    private Faction[] factions = null;

    public void SetFactions(Faction[] newFactions)
    {
        factions = newFactions;
    }

    private Faction[] GetFactions()
    {
        return factions ?? (factions = CreateFactions());
    }

    private Faction[] CreateFactions()
    {
        return new Faction[] {
            new Faction("Commander", 0, Color.green),
            new Faction("Overmind", 1, Color.red)
        };
    }
}
