void OnGUI() { GUIStyle style = new GUIStyle(); style.normal.textColor = Color.red; style.fontSize = 40; style.fontStyle = FontStyle.Bold; GUI.skin.font = pixelFont; style.normal.textColor = Color.green; AdvancedTextRendering.DrawOutline(new Rect(Screen.width / 2, 40, 100, 100), scoreText, style, Color.black, Color.magenta, 0.9f); AdvancedTextRendering.DrawOutline(new Rect(Screen.width / 2, 80, 100, 100), highScoreText, style, Color.black, Color.white, 0.9f); Color c = GUI.backgroundColor; GUI.backgroundColor = Color.clear; string gameOverMessage = "P1 Win"; bool p1Lost = objPlayer.getGameOver(); if (!p1Lost) { if (gameOver) { style.fontSize = 60; style.normal.textColor = Color.cyan; Rect rect = new Rect((Screen.width) / 2 - 150, (Screen.height) / 2 - 50, 0, 0); //GUI.Label(rect, "Try again",style); AdvancedTextRendering.DrawOutline(rect, gameOverMessage, style, Color.black, Color.green, 0.9f); StopTime(); Rect rect3 = new Rect(0, 0, Screen.width, Screen.height); GUI.depth = 2; if (GUI.Button(rect3, "")) { //Click on 2p mode ResumeTime(); Jump(); } } } //GUI.backgroundColor = c; }
void OnGUI() { GUIStyle style = new GUIStyle(); style.normal.textColor = Color.red; style.fontSize = 40; style.fontStyle = FontStyle.Bold; GUI.skin.font = pixelFont; style.normal.textColor = Color.green; //GUI.Label(new Rect(20, 20, 100, 100), scoreText, style); AdvancedTextRendering.DrawOutline(new Rect(0, 40, 100, 100), scoreText, style, Color.black, Color.green, 0.9f); AdvancedTextRendering.DrawOutline(new Rect(0, 80, 100, 100), highScoreText, style, Color.black, Color.white, 0.9f); string gameOverMessage = "Try again"; Color colorGameOver = Color.cyan; if (numPlayers == 2) { gameOverMessage = "P2 Win"; colorGameOver = Color.magenta; if (objPlayer2.getGameOver()) { gameOverMessage = "Draw"; colorGameOver = Color.cyan; } } Color c = GUI.backgroundColor; GUI.backgroundColor = Color.clear; if (!gameOver && !paused) { if (numPlayers == 2) { if (!objPlayer2.getGameOver()) { Rect rectP1 = new Rect(0, 0, (Screen.width / 2), (Screen.height)); if (GUI.Button(rectP1, "")) { if (!paused) { Jump(); } } Rect rectP2 = new Rect((Screen.width / 2), 0, (Screen.width / 2), (Screen.height)); if (GUI.Button(rectP2, "")) { if (!paused) { objPlayer2.Jump(); } } } } } if (gameOver) { style.fontSize = 60; style.normal.textColor = Color.cyan; Rect rect = new Rect((Screen.width) / 2 - 150, (Screen.height) / 2 - 50, 0, 0); //GUI.Label(rect, "Try again",style); AdvancedTextRendering.DrawOutline(rect, gameOverMessage, style, Color.black, colorGameOver, 0.9f); StopTime(); Rect rect3 = new Rect(0, 0, Screen.width, Screen.height); GUI.depth = 1; if (GUI.Button(rect3, "")) { ResumeTime(); Jump(); } } //GUI.backgroundColor = c; }
void OnGUI() { GUIStyle style = new GUIStyle(); style.normal.textColor = Color.red; style.fontSize = 40; style.fontStyle = FontStyle.Bold; GUI.skin.font = pixelFont; style.normal.textColor = Color.green; float w = 100; float h = 100; Rect rect = new Rect((Screen.width - w) / 2, (Screen.height - h) / 2 + 50, w + 50, h / 2); AdvancedTextRendering.DrawOutline(rect, start, style, Color.black, Color.green, 0.9f); style = new GUIStyle(); style.normal.textColor = Color.red; style.fontSize = 80; style.fontStyle = FontStyle.Bold; Rect rect2 = new Rect((Screen.width - w) / 3, (Screen.height - h) / 2 - 100, (Screen.width / 2) + 100, h); Color c = GUI.backgroundColor; GUI.backgroundColor = Color.clear; if (GUI.Button(rect, "")) { Application.LoadLevel("level1"); } AdvancedTextRendering.DrawOutline(rect2, ropemania, style, Color.white, Color.red, 2f); Rect rect3 = new Rect((Screen.width - w) / 2, (Screen.height - h) / 2 + 150, w + 100, h / 2); if (GUI.Button(rect3, "")) { //Click on 2p mode PlayerPrefs.SetInt("numPlayers", 2); Application.LoadLevel("level1"); } GUI.backgroundColor = c; style.normal.textColor = Color.yellow; style.fontSize = 40; style.fontStyle = FontStyle.Bold; AdvancedTextRendering.DrawOutline(rect3, twoPlayerMode, style, Color.black, Color.yellow, 0.9f); }