private void DisplayHealth() { if (currentHealth > 0) { GUI.Box(new Rect(10, 10, 140, 60), HealthBars[currentHealth]); } else if (currentHealth == 0) { GUI.Box(new Rect(10, 10, 140, 60), HealthBars[1]); } else if (currentHealth == -1) { GUI.Box(new Rect(10, 10, 140, 60), HealthBars[0]); currentHealth = 1; } else { GUI.Box(new Rect(10, 10, 140, 60), HealthBars[0]); } if (Health >= 0) { GUI.Label(new Rect(90, 50, 30, 30), ((int)Health).ToString(), GUIAssist.BiggerText(20)); } else { GUI.Label(new Rect(90, 50, 30, 30), "DEAD", GUIAssist.BiggerText(20)); } }
private void OnGUI() { if (paused) { GUI.Box(new Rect(startX, startY, 400, 300), "", pauseBackgroundColor); GUI.Label(new Rect(startX + 50, startY, 100, 100), "Game is paused!", GUIAssist.BiggerText(40)); if (GenerateButton("RESUME GAME", 40) || Input.GetKeyDown(KeyCode.Escape)) { paused = togglePause(); } if (GenerateButton("MAIN MENU", 80)) { Application.LoadLevel(0); } if (GenerateButton("RESTART", 140)) { GameObject.Find("GameInformation").GetComponent <GameInformation>().forseRestart = true; } if (GenerateButton("QUIT", 180)) { Application.Quit(); } if (Input.GetKeyDown(KeyCode.Escape)) { paused = togglePause(); } PauseTanks(); } Vector3 mousePosition = Input.mousePosition; Rect setMousePosition = new Rect(mousePosition.x, Screen.height - mousePosition.y, 25, 25); GUI.Label(setMousePosition, cursorImage); }
private void DrawEndGame() { GUI.Box(new Rect(Screen.width / 2 - 230, 100, 100, 200), "END OF GAME SESSION", GUIAssist.BiggerText(40)); string winner = ""; if (playerScore >= scoreLimit) { winner = "A human "; } else { winner = "A bot has "; } GUI.Box(new Rect(Screen.width / 2 - 155, 150, 270, 50), ""); GUI.Label(new Rect(Screen.width / 2 - 150, 150, 100, 50), winner + "won!", GUIAssist.BiggerText(40)); if (GUI.Button(new Rect(Screen.width / 2 - 210, 200, 100, 50), "")) { Application.Quit(); } GUI.Label(new Rect(Screen.width / 2 - 210, 200, 100, 50), "QUIT", GUIAssist.BiggerText(40)); if (GUI.Button(new Rect(Screen.width / 2, 200, 250, 50), "")) { Application.LoadLevel(0); } GUI.Label(new Rect(Screen.width / 2 + 5, 200, 200, 50), "PLAY AGAIN", GUIAssist.BiggerText(40)); }
private void DrawTime(Rect rectriangle, int time) { time = 5 - time; Rect labelRect = rectriangle; labelRect.x /= 2; labelRect.x -= 10; labelRect.x += 140; labelRect.y += 50;; labelRect.height = 80; labelRect.width = 80; Rect boxRect = labelRect; boxRect.x -= 8; boxRect.y -= 8; if (time != 10) { labelRect.x += 15; } GUI.Box(boxRect, ""); GUI.Label(labelRect, time.ToString(), GUIAssist.BiggerText(60)); boxRect.x -= 190; boxRect.y += 3; boxRect.width += 100; boxRect.height -= 40; GUI.Box(boxRect, ""); labelRect.x -= 200; GUI.Label(labelRect, "Playing to " + scoreLimit, GUIAssist.BiggerText(30)); }
private void DrawUser(Rect rectriangle, string user, int score, GUIStyle style) { Rect labelRect = rectriangle; labelRect.x /= 2; labelRect.x += 30; labelRect.y /= 2; labelRect.height /= 2; labelRect.width /= 2; GUI.Label(labelRect, user, style); Rect scoreRect = labelRect; scoreRect.y += 30; scoreRect.width /= 2; scoreRect.width += scoreLimitZeros * 10; scoreRect.height /= 2; GUI.Box(scoreRect, ""); GUI.Label(scoreRect, score.ToString(), GUIAssist.BiggerText(40)); scoreRect.x -= 40; scoreRect.y += 10; if (!playerWin && user == "Bot") { GUI.Label(scoreRect, "+1", UserBox(!playerWin)); } else if (playerWin && user == "Player") { GUI.Label(scoreRect, "+1", UserBox(playerWin)); } }
private void DisplayAmmo() { GUI.Label(new Rect(10, Screen.height - 75, 75, 50), " Shells", GUIAssist.BiggerText(20)); GUI.Box(new Rect(10, Screen.height - 50, 75, 50), ""); GUI.Label(new Rect(15, Screen.height - 40, 75, 50), ShellAmmo.ToString(), GUIAssist.BiggerText(30)); GUI.Label(new Rect(Screen.width - 85, Screen.height - 75, 75, 50), " Rockets", GUIAssist.BiggerText(20)); GUI.Box(new Rect(Screen.width - 75, Screen.height - 50, 75, 50), ""); GUI.Label(new Rect(Screen.width - 60, Screen.height - 40, 75, 50), RocketAmmo.ToString(), GUIAssist.BiggerText(30)); }
public void MainMenu() { if (GUI.Button(new Rect(0, Screen.height - 100, 100, 100), "Quit")) { Application.Quit(); } if (GUI.Button(new Rect(Screen.width - 100, Screen.height - 100, 100, 100), "Play")) { Properties = true; } TankAnimation(); GUI.Label(new Rect(startX + 250, startY + 280, 100, 100), "H.A.T.", GUIAssist.BiggerText(40)); GUI.Label(new Rect(startX, startY + 330, 100, 100), "HEATED AFFRAYS WITH TANKS", GUIAssist.BiggerText(40)); }