using UnityEngine;
using System.Collections;

public struct LevelConfig
{
    public float minimumScore;
    public int figures;
    public int dots;
    public int slices;
    public bool specialMoves;
    public int highScore;

    public int NormalScore()
    {
        return figures * dots * slices * 200;
    }

    public int MaxScore()
    {
        return NormalScore() * 4;
    }

    public int MinScore()
    {
        return (int)(NormalScore() * minimumScore);
    }
}

public class LevelData : MonoBehaviour {
    public static LevelData Instance;

    public int levelNum;

    public float[] minimumScore;
    public int[] figures;
    public int[] dots;
    public int[] slices;
    public bool[] specialMoves;

    public int[] highScore;

    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        } else {
            Destroy(gameObject);
        }
    }

    void Start()
    {
        highScore = new int[levelNum];
        for (int i = 0; i < levelNum; i++)
        {
            highScore[i] = 100;
        }
    }

    public LevelConfig CurrentLevelConfig()
    {
        int index = LevelButton.CurrentLevelIndex;
        LevelConfig config = new LevelConfig();

        config.dots = dots[index];
        config.slices = slices[index];
        config.figures = figures[index];
        config.minimumScore = minimumScore[index];
        config.specialMoves = specialMoves[index];
        config.highScore = highScore[index];

        return config;
    }
}
