/** * Draws the background image for the mouth loading screen */ void OnGUI() { counter = GameObject.Find("MouthChooseBackground"); // find the reference to the mouth background choser level = counter.GetComponent <MouthLoadLevelCounter> (); // get the current level from the counter // draw the proper level load screen to take up the entiere screen GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), backgrounds [Mathf.Clamp(level.getLevel() - 1, 0, level.getMaxLevels())]); }
/** * Handles drawing of stats information and all related graphics */ void OnGUI() { // Draw the number of stars text GUIStyle starStyle = new GUIStyle(); // create new style starStyle.font = (Font)Resources.Load("Fonts/JandaManateeSolid"); // set font style starStyle.normal.textColor = Color.yellow; // set font color starStyle.fontSize = (int)(34f / 597f * Screen.height); // set a relative font size // draw the text indicating the number of stars in the specified area GUI.Label(new Rect((290f / 1024f) * Screen.width, (138f / 768f) * Screen.height, (100f / 1024f) * Screen.width, (100f / 768f) * Screen.height), "" + numStars, starStyle); // draw the actual stars if (numStars == 1) { GUI.DrawTexture(new Rect((48f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((142f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), emptyStar); GUI.DrawTexture(new Rect((236f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), emptyStar); GUI.DrawTexture(new Rect((330f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), emptyStar); GUI.DrawTexture(new Rect((424f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), emptyStar); } else if (numStars == 2) { GUI.DrawTexture(new Rect((48f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((142f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((236f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), emptyStar); GUI.DrawTexture(new Rect((330f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), emptyStar); GUI.DrawTexture(new Rect((424f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), emptyStar); } else if (numStars == 3) { GUI.DrawTexture(new Rect((48f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((142f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((236f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((330f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), emptyStar); GUI.DrawTexture(new Rect((424f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), emptyStar); } else if (numStars == 4) { GUI.DrawTexture(new Rect((48f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((142f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((236f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((330f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((424f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), emptyStar); } else if (numStars == 5) { GUI.DrawTexture(new Rect((48f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((142f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((236f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((330f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); GUI.DrawTexture(new Rect((424f / 1024f) * Screen.width, (236f / 768f) * Screen.height, (74f / 1024f) * Screen.width, (74f / 768f) * Screen.height), filledStar); } // Draw the stats text GUIStyle statsStyle = new GUIStyle(); // create a new style statsStyle.font = (Font)Resources.Load("Fonts/JandaManateeSolid"); // set the font statsStyle.normal.textColor = Color.yellow; // set the font color statsStyle.fontSize = (int)(20f / 597f * Screen.height); // set the font relative size // create 2 labels to display the stats in text GUI.Label(new Rect((600f / 1024f) * Screen.width, (90f / 768f) * Screen.height, (((961f - 27f) - 600f) / 1024f) * Screen.width, ((520f - 90f) / 768f) * Screen.height), "Longest Streak:\n" + "Coughs:\n" + "Food Lost:\n" + "Food Swallowed:\n" + "Highest Multiplier:\n" + "Score:\n" + "\n" + //TODO: move this somewhere? "\n" + //TODO: move this somehwere? " High Score:", //TODO: move this somewhere? statsStyle); // this second label is needed to line up everything since we aren't using a fixed size font GUI.Label(new Rect((820f / 1024f) * Screen.width, (90f / 768f) * Screen.height, (((961f - 27f) - 600f) / 1024f) * Screen.width, ((520f - 90f) / 768f) * Screen.height), "" + longestStreak + "\n" + "" + timesCoughed + "\n" + "" + foodLost + "\n" + "" + foodSwallowed + "\n" + "" + highestMultiplier + "x\n" + "" + score + "\n" + "\n" + //TODO: move this somewhere? "\n" + //TODO: move this somewhere? "" + prevHighScore, //TODO: move this somewhere? statsStyle); // draw the button for next level in the specified area of the screen if (GUI.Button(new Rect((635f / 1024f) * Screen.width, (535f / 768f) * Screen.height, ((905f - 635f) / 1024f) * Screen.width, ((665f - 535f) / 768f) * Screen.height), "", nextLevelButton)) { // make sure to not show the load screen after we're done if (level.getLevel() > level.getMaxLevels()) { Application.LoadLevel("MouthEndStoryboard"); // if the mouth game is done then we load the small // intestine story } else { Application.LoadLevel("LoadLevelMouth"); // if there are more mouth levels than load the next one } } }