Advertisement
Guest User

Untitled

a guest
Dec 7th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.30 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;  // narzedzie do ladowania scen
  5.  
  6. public class Game_Menager_Script : MonoBehaviour
  7. {
  8.     public static int lives = 3;
  9.     public static int Difficulty = 0;
  10.     public enum MenuState { main, options, how, game }    //typ zmiennej , pozwala wyszczegolnic opcje do wyboru
  11.     public MenuState state;     // konkretna zmienna do enuma
  12.  
  13.     public static bool IsMushroom = false;
  14.  
  15.     // Use this for initialization
  16.     void Start ()
  17.     {
  18.        
  19.     }
  20.    
  21.     // Update is called once per frame
  22.     void Update ()
  23.     {
  24.        
  25.     }
  26.  
  27.     private void OnGUI()
  28.     {
  29.         if (state == MenuState.main)
  30.         {
  31.             if (GUI.Button(new Rect(0, 0, 200, 30), "Nowa Gra"))       // odleglosc,odstep,szerokosc,wysokosc
  32.             {
  33.                 SceneManager.LoadScene("level_1");              
  34.             }
  35.             if (GUI.Button(new Rect(0, 40, 200, 30), "Opcje"))
  36.             {
  37.                 state = MenuState.options;
  38.             }
  39.             if (GUI.Button(new Rect(0, 80, 200, 30), "Jak grać?"))
  40.             {
  41.                 state = MenuState.how;
  42.             }
  43.             if (GUI.Button(new Rect(0, 120, 200, 30), "Wyjście"))
  44.             {
  45.                 Application.Quit();
  46.             }
  47.         }
  48.  
  49.         if (state == MenuState.options)
  50.         {
  51.             if (GUI.Button(new Rect(0, 0, 200, 30), "Easy"))
  52.             {
  53.                 Difficulty = 0;
  54.                 state = MenuState.main;
  55.             }
  56.  
  57.             if (GUI.Button(new Rect(0, 40, 200, 30), "Medium"))
  58.             {
  59.                 Difficulty = 1;
  60.                 state = MenuState.main;
  61.             }
  62.  
  63.             if (GUI.Button(new Rect(0, 80, 200, 30), "Hard"))
  64.             {
  65.                 Difficulty = 2;
  66.                 state = MenuState.main;
  67.             }
  68.  
  69.             if (GUI.Button(new Rect(0, 120, 200, 30), "Back"))
  70.             {
  71.                 state = MenuState.main;
  72.             }
  73.         }
  74.  
  75.         if (state == MenuState.how)
  76.         {
  77.             GUI.Label(new Rect(0, 0, 500, 100), "Zbierz wszystkie punkty");
  78.             if (GUI.Button(new Rect(0, 120, 200, 30), "Back"))
  79.             {
  80.                 state = MenuState.main;
  81.             }
  82.         }
  83.     }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement