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

public class MainMenu : MonoBehaviour {
    private PlayerStats stats;

    // Use this for initialization
    void Start() {
        stats = GameObject.Find("CharacterDisplay").GetComponent<PlayerStats>();
    }

    // Update is called once per frame
    void Update() {

    }

    public void OnClickPlay() {
        // from main menu 'Play Game' -> character creation screen
        SceneManager.LoadScene("CharacterCreator");
    }

    public void OnClickHowTo() {
        // from main menu 'How to Play' -> controls screen
        SceneManager.LoadScene("HowToPlay");
    }

    public void OnClickDone() {
        stats.heal(); // spawn with full health - necessary after player portrait implementation
        if (ChooseCharStats.unallocated == 0 && ChooseCharStats.playerName != null) {
            SceneManager.LoadScene("Town01");
        }
        // from character creation -> first scene of the game
        //if we have unallocated stats, we cannot proceed to the game.
        //          float messageDuration = 5;
        // if (ChooseCharStats.unallocated == 0) SceneManager.LoadScene("Town01");
        //        else if (ChooseCharStats.unallocated > 0) 
        //        {
        //            while (messageDuration > 0)
        //            {
        //                messageDuration -= Time.deltaTime;
        //                ChooseCharStats.unalocText.text = "Must Allocate All Remaining Stat Points";
        //            }
        //            ChooseCharStats.unalocText.text = "Unallocated: " + ChooseCharStats.unallocated.ToString();
        //        }
    }
}