using UnityEngine;
using System.Collections;

public class GameManager : MonoBehaviour {

    public enum State {
        Title,
        Game,
        Win,
        Lose
    }

    void Awake() {
        DontDestroyOnLoad(gameObject);
    }

    void Update() {
        if (Input.GetKeyDown(KeyCode.Escape)) {
            Application.Quit();
        }
    }

    public static void SetGameState(GameManager.State state) {
        if (state == GameManager.State.Lose) {
            print("You lose!");
            ChapterManager.StopChapter();
            Application.LoadLevel("lose");
        }

        if (state == GameManager.State.Win) {
            print("You win!");
            ChapterManager.StopChapter();
            Application.LoadLevel("win");
        }
    }
}
