using UnityEngine;
using System.Collections;

public class Button : MonoBehaviour {

    public Sprite normal;
    public Sprite hover;
    public bool isQuit = false;
    public bool isPlay = false;
    public int gameLevelIndex;

    void OnMouseEnter () {
        GetComponent<SpriteRenderer>().sprite = hover;
	}

    void OnMouseExit(){
        GetComponent<SpriteRenderer>().sprite = normal;
    }

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

    void OnMouseUp(){
		if (isQuit)
			Application.Quit();
        if (isPlay)
            Application.LoadLevel(gameLevelIndex);
    }
}
