using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour {
private delegate void MenuDelegate();
public AudioClip click;
private float screenHeight;
private float screenWidth;
private float buttonHeight;
private float buttonWidth;
//Variables End
void Start ()
{
screenHeight = Screen.height;
screenWidth = Screen.width;
buttonHeight = screenHeight * 0.1f;
buttonWidth = screenWidth * 0.5f;
//here we set the menuFunction to point to the anyKey function, which is further down in the code
}
void OnGUI () {
// Make a background box
//GUI.Box (new Rect (Screen.width / 2 - 190, 100, 100, 100), "Menu");
// Make the first button. If it is pressed, Application.Loadlevel (Beta World) will be executed
GUI.backgroundColor = Color.green;
if(GUI.Button(new Rect((screenWidth - buttonWidth) * 0.5f, screenHeight * 0.4f, buttonWidth, buttonHeight), "Choose Mode"))
{
Application.LoadLevel ("gamemode");
audio.PlayOneShot (click);
}
// Make the second button.
GUI.backgroundColor = Color.yellow;
if(GUI.Button(new Rect((screenWidth - buttonWidth) * 0.5f, screenHeight * 0.5f, buttonWidth, buttonHeight), "Instruction"))
{
Application.LoadLevel ("instruction");
audio.PlayOneShot (click);
}
//Exit Game button
GUI.backgroundColor = Color.blue;
if(GUI.Button(new Rect((screenWidth - buttonWidth) * 0.5f, screenHeight * 0.6f, buttonWidth, buttonHeight), "Option"))
{
Application.LoadLevel ("option");
audio.PlayOneShot (click);
}
//Options button, Use variables
GUI.backgroundColor = Color.red;
if(GUI.Button(new Rect((screenWidth - buttonWidth) * 0.5f, screenHeight * 0.7f, buttonWidth, buttonHeight), "Top Score"))
{
Application.LoadLevel ("score");
audio.PlayOneShot (click);
}
}
}