void OnGUI() { switch (currentStarmapMenuState) { case StarmapMenuState.mainMenu: mainMenu.Display(); break; case StarmapMenuState.confirmMenu: mainMenu.Display(); GUI.Box(confirmMenuRect, "Confirm"); confirmMenu.Display(); break; case StarmapMenuState.pauseMenu: mainMenu.Display(); GUI.Box(pauseMenuRect, "Pause"); pauseMenu.Display(); break; case StarmapMenuState.optionsMenu: GUI.Box(pauseMenuRect, "Pause"); optionsMenu.Display(); break; case StarmapMenuState.inputMenu: GUI.Box(pauseMenuRect, "Pause"); inputMenu.Display(); break; } ButtonLabels(); }
void OnGUI() { GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), background, ScaleMode.StretchToFill); GUI.Box(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 100, 200, 200), ""); //just to see the menu switch (currentMenuState) { case MainMenuState.mainMenu: mainMenu.Display(); break; case MainMenuState.optionsMenu: optionsMenu.Display(); break; case MainMenuState.inputMenu: inputMenu.Display(); break; case MainMenuState.soundMenu: break; case MainMenuState.graphicsMenu: break; } }
void OnGUI (){ GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height), backgroundTex, ScaleMode.StretchToFill); GUI.skin = mySkin; if (render == true){ Title(); if (confirmStarMap == true){ GUI.Window(1, popupRect, ConfirmStarMap, "Confirm"); } switch (currentState){ case Menu.SupportBay: supportBayMenu.Display(); break; case Menu.BuyEquipables: if (Input.GetButtonDown("Pause"))currentState = Menu.SupportBay; GUILayout.Label("Equipment Shop"); // GUI.Box(physicalWeaponsRect,"Physical Weapons"); // GUI.Box(energyWeaponsRect, "Energy Weapons"); // GUI.Box(explosiveWeaponsRect, "Explosive Weapons"); // GUI.Box(devicesRect, "Devices"); buyEquipablesMenu.Display(); break; case Menu.ConfirmBuyEquipable: // GUI.Box(physicalWeaponsRect,"Physical Weapons"); // GUI.Box(energyWeaponsRect, "Energy Weapons"); // GUI.Box(explosiveWeaponsRect, "Explosive Weapons"); // GUI.Box(devicesRect, "Devices"); buyEquipablesMenu.Display(); GUI.Box(popupRect, "Confirm", "window"); confirmBuyEquipableMenu.Display(); case Menu.BuyUpgrades: BuyUpgrades(); if (Input.GetButtonDown("Pause"))currentState = Menu.SupportBay; break; case Menu.Options: GUI.Box(optionsMenuRect, "Options", "window"); optionsMenu.Display(); break; case Menu.InputOptions: GUI.Box(optionsMenuRect, "Input Options", "window"); inputOptionsMenu.Display(); break; } ButtonLabels(); } }
void OnGUI() { /**** Health bar ****/ if (player != null) { //Rects work at Rect(screenPosition X, screenPosition Y, width, height) all in pixels GUI.Label(new Rect(Screen.width / 30, Screen.height / 30, (Screen.width / 10) * PercentHealth(player), Screen.height / 20), "", healthbar); GUI.Label(new Rect((Screen.width / 30) - 1, (Screen.height / 30) - 1, (Screen.width / 10) + 2, (Screen.height / 20) + 2), "" + Mathf.RoundToInt(player.GetComponent <PlayerStats>().Health) + " / " + player.GetComponent <PlayerStats>().maxHealth, border); // /**** Heat bar ****/ GUI.Label(new Rect((Screen.width / 30) * 4.5f, Screen.height / 30, (Screen.width / 10) * PercentHeat(), Screen.height / 20), "", heat); GUI.Label(new Rect(((Screen.width / 30) * 4.5f) - 1, (Screen.height / 30) - 1, (Screen.width / 10) + 2, (Screen.height / 20) + 2), "" + Mathf.RoundToInt(playerStats.heat) + " / " + playerStats.maxHeat, border); /**** Overheat ****/ if (playerStats.overheat) { GUI.Label(new Rect(Screen.width / 2, Screen.height / 2, 100, 100), "OVERHEAT"); } /**** Credits ****/ GUI.Label(new Rect(0, 20, Screen.width, 20), "Credits " + playerStats.creditsThisLevel, credits); /**** Weapons ****/ GUI.BeginGroup(new Rect(Screen.width - (Screen.width / 3.5f), Screen.height / 30, Screen.width / 3.5f - Screen.width / 30, Screen.height / 6)); //GUI.Box(Rect(0,0,Screen.width,Screen.height),"", weaponsBackground); //weapon 0ne GUI.Label(new Rect(Screen.width / 60, Screen.height / 60, (Screen.width / 10) * percentCooldown(player.GetComponent <BlunderBuster>().blunderBuster.currentLevel.cooldown, player.GetComponent <BlunderBuster>().blunderBuster.currentLevel.ltShot), Screen.height / 20), "", cooldown); GUI.Label(new Rect(Screen.width / 60 - 1, Screen.height / 60 - 1, Screen.width / 10 + 2, Screen.height / 20 + 2), "Blunder Buster", border); //weapon two GUI.Label(new Rect((Screen.width / 60) * 8, Screen.height / 60, (Screen.width / 10) * percentCooldown(player.GetComponent <FusionBeam>().fusionBeam.currentLevel.cooldown, player.GetComponent <FusionBeam>().fusionBeam.currentLevel.ltShot), Screen.height / 20), "", cooldown); GUI.Label(new Rect((Screen.width / 60) * 8 - 1, Screen.height / 60 - 1, Screen.width / 10 + 2, Screen.height / 20 + 2), "Fusion Beam", border); //weapon three GUI.Label(new Rect((Screen.width / 60), (Screen.height / 60) * 5, (Screen.width / 10) * percentCooldown(player.GetComponent <RedRocket>().redRocket.currentLevel.cooldown, player.GetComponent <RedRocket>().redRocket.currentLevel.ltShot), Screen.height / 20), "", cooldown); GUI.Label(new Rect(Screen.width / 60 - 1, (Screen.height / 60) * 5 - 1, Screen.width / 10 + 2, Screen.height / 20 + 2), "Red Rocket", border); //weapon four //GUI.Label(Rect(11,11,118,63), "", cooldown); // GUI.Label(new Rect((Screen.width / 60) * 8, (Screen.height / 60) * 5, // (Screen.width / 10) * percentCooldown(player.GetComponent<WeaponName>().cooldown, player.GetComponent<WeaponName>.ltShot), Screen.height / 20), // "", cooldown); // GUI.Label(new Rect((Screen.width / 60) * 8 - 1, (Screen.height / 60) * 5 - 1, Screen.width / 10 + 2, Screen.height / 20 + 2), "Weapon 4", border); GUI.EndGroup(); } else { /**** Dying ****/ if (GUI.Button(new Rect((Screen.width / 2) - 35, (Screen.height / 2) - 15, 70, 30), "Replay?")) { Application.LoadLevel("MainMenu"); } Time.timeScale = 0; GUI.DrawTexture(new Rect(0, 0, Screen.width + 10, Screen.height + 10), alphagrey, ScaleMode.StretchToFill, true, 1.0f); } /**** Kill boss ****/ if (boss == null) { GUI.Label(new Rect(Screen.width / 2, Screen.height / 2, Screen.width / 2 - 100, Screen.height / 2 + 120), "End Test Level"); } /**** Enemy health bars *** * foreach (GameObject enemy in enemiesForHealthbars) * { * if (enemy == null) * return; * GUI.Label (new Rect(camera.WorldToScreenPoint(enemy.transform.position).x-14, * camera.WorldToScreenPoint(enemy.transform.position).y+140//coefficient needed to lift bar above unit * ,40*PercentHealth(enemy),4),"",healthbar); * }*/ /**** Level Up ****/ if (Time.time < levelledTime + levelUpDisplayTime) { GUI.Label(new Rect(0, 0, Screen.width, Screen.height - Screen.height / 4), levelledName + " is level " + levelledLevel, levelUp); } /**** Pause Menu ****/ if (paused) { //pause game GUI.DrawTexture(new Rect(0, 0, Screen.width + 10, Screen.height + 10), alphagrey, ScaleMode.StretchToFill, true, 1.0f); //dim the screen with negro-engineered filter since filters are only for Pro Rect pausedRect = new Rect(0, 0, Screen.width / 3, (Screen.height / 4) * 3); pausedRect.center = new Vector2(Screen.width / 2, Screen.height / 2); GUI.Box(pausedRect, "Paused", mySkin.box); switch (currentPausedMenuState) { case PausedMenuState.mainMenu: mainPauseMenu.Display(); break; case PausedMenuState.optionsMenu: optionsMenu.Display(); break; case PausedMenuState.inputMenu: inputMenu.Display(); break; } } }