-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainMenu.cs
35 lines (31 loc) · 967 Bytes
/
MainMenu.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour {
public int mainContainerWidth = 250;
public int mainContainerHeight = 450;
public int buttonWidth = 200;
public int buttonHeight = 50;
private int xContPos;
private int yContPos;
void OnGUI(){
GUI.Box(new Rect((xContPos),yContPos,mainContainerWidth,mainContainerHeight), "Risk In Space");
if (GUI.Button (new Rect(xContPos + ((mainContainerWidth - buttonWidth)/2),
yContPos + 50, buttonWidth, buttonHeight), "New Game"))
{
Application.LoadLevel("GameSetup");
}
if (GUI.Button (new Rect(xContPos + ((mainContainerWidth - buttonWidth)/2),
yContPos + 105, buttonWidth, buttonHeight), "Exit"))
{
Application.Quit();
}
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
xContPos = (Screen.width/2)-(mainContainerWidth/2);
yContPos = (Screen.height/2)-(mainContainerHeight/2);
}
}