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

public enum PlayerNames{
	GUITARRISTA,
	FLAUTISTA,
	NENHUM
}

public enum Teams{
	BLUE,
	RED
}

public enum Joysticks{
	JOYSTICK_1,
	JOYSTICK_2,
	JOYSTICK_3,
	JOYSTICK_4
}

[System.Serializable]
public struct PlayerRoundSettings{
	public PlayerNames playerName;
	public Teams playerTeam;
	public Joysticks joystick;
}

public class Game : MonoBehaviour {

	public static Game instance;
	private string nextScene;

	private List<PlayerRoundSettings> playersRoundSettings=new List<PlayerRoundSettings>();

	public static string GetNextScene(){
		return instance.nextScene;
	}

	public static List<PlayerRoundSettings> PlayersSettings{
		get{
			return instance.playersRoundSettings;
		}
	}

	public static void ResetRoundPlayerSettings(){
		instance.playersRoundSettings.Clear ();
	}

	public static void AddPlayer(PlayerNames playerName, Teams team, Joysticks joystick){
		PlayerRoundSettings  prs= new PlayerRoundSettings ();
		prs.playerName = playerName;
		prs.playerTeam = team;
		prs.joystick = joystick;
		instance.playersRoundSettings.Add (prs);
	}

	public static void OpenScene(string sceneName){
		instance.nextScene=sceneName;
		SceneManager.LoadScene ("Loading");
	}

	// Use this for initialization
	void Awake () {
		if (instance)
			Destroy (gameObject);
		else {
			instance = this;
			DontDestroyOnLoad (gameObject);
		}
	}

}
