using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TitleScreen : BaseScreen {

	#region DIFFICULTY_BUTTONS	
	public Button easyButton;
	public Button mediumButton;
	public Button hardButton;

	public Button vsHumanButton;
	#endregion

	#region CONTROL_BUTTONS
	public Button wasdButton;
	public Button zqsdButton;

	public List<PlayerControls> controlList;

	#endregion

	void Start()
	{
		EasyOpponent();
		SetControls(this.controlList[0]);
	}

	public void EasyOpponent()
	{
		GameManager.Instance.SetDifficulty(Difficulty.Easy);
		easyButton.image.color = Color.green;
		mediumButton.image.color = Color.white;
		hardButton.image.color = Color.white;
		vsHumanButton.image.color = Color.white;
	}

	public void MediumOpponent()
	{
		GameManager.Instance.SetDifficulty(Difficulty.Medium);
		easyButton.image.color = Color.white;
		mediumButton.image.color = Color.green;
		hardButton.image.color = Color.white;
		vsHumanButton.image.color = Color.white;
	

	}

	public void HardOpponent()
	{
		GameManager.Instance.SetDifficulty(Difficulty.Hard);
		easyButton.image.color = Color.white;
		mediumButton.image.color = Color.white;
		hardButton.image.color = Color.green;
		vsHumanButton.image.color = Color.white;
	
	}

	public void VsHuman()
	{
		GameManager.Instance.SetDifficulty(Difficulty.VsHuman);
		easyButton.image.color = Color.white;
		mediumButton.image.color = Color.white;
		hardButton.image.color = Color.white;
		vsHumanButton.image.color = Color.green;
	}

	public void GoButton()
	{
		GameManager.Instance.SpawnStage();
		ScreenManager.Instance.Hide(this.name);
	}

	public void SetControls(PlayerControls controls)
	{
		int index = this.controlList.IndexOf(controls);
		Button[] allButtons = new Button[]{wasdButton, zqsdButton};
		
		for (int i = 0; i < allButtons.Length; i ++)
		{
			allButtons[i].image.color = index == i ? Color.green : Color.white;
		}

		GameManager.Instance.SetPlayerKeyboard(controls);
	}
}
