Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class MainMenuGUI : MonoBehaviour {
- //Variables
- public GUIStyle PlayButton;
- public GUIStyle OptionsButton;
- public GUIStyle InstructionsButton;
- public GUIStyle ExitButton;
- public Texture Background;
- bool doWindow0 = false;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- doWindow0 = false;
- }
- void OnGUI () {
- //GUI Matrix and GUI Scaling
- Vector3 scale;
- int originalWidth = 1600;
- int originalHeight = 770;
- scale.x = Screen.width/originalWidth;
- scale.y = Screen.height/originalHeight;
- scale.z = 1;
- Matrix4x4 svMat = GUI.matrix;
- GUI.matrix = Matrix4x4.TRS(new Vector3(0,0,0), Quaternion.identity, scale);
- //Start Matrix
- //Draw Background
- GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),Background,ScaleMode.StretchToFill, false, 0.0f);
- //End Draw Background
- //Draw PlayButton
- if (GUI.Button(new Rect(30,180,235,590),"",PlayButton))
- {
- Application.LoadLevel("LoginScreen");
- }
- //End Draw PlayButton
- //Draw OptionsButton
- GUI.Button(new Rect(260,330,220,440),"",OptionsButton);
- //End Draw OptionsButton
- //Draw InstructionsButton
- if (GUI.Button(new Rect(1160,330,145,440),"",InstructionsButton))
- {
- doWindow0 = true;
- }
- //End Draw InstructionsButton
- //Draw ExitButton
- if (GUI.Button(new Rect(1320,180,265,590),"",ExitButton))
- {
- Application.Quit();
- }
- //End Draw ExitButton
- //End Matrix
- GUI.matrix = svMat;
- if (doWindow0 == true)
- GUI.Window (0, new Rect(Screen.width/2-240,Screen.height/2-100,800,120), DoMyWindow, "Instructions:");
- }
- void DoMyWindow (int windowID) {
- GUI.Label (new Rect (10, 20, 800, 40), "Welcome to RedLightLife! Use WASD keys to move your character and use KL to rotate the camera. Use the J key to interact with people and objects. To have your character jump use the SPACEBAR. To pause your game, press the P key.");
- if (GUI.Button (new Rect (10,80,100,20), "Close"))
- doWindow0 = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment