/// <summary> /// Draws an unfilled rectangle. /// </summary> /// <param name="Left">Left margin</param> /// <param name="Top">Top margin</param> /// <param name="Width">Width</param> /// <param name="Height">Height</param> /// <param name="Thickness">Thickness</param> /// <param name="Tex">Texture</param> public static void GUIRectangle(int Left, int Top, int Width, int Height, int Thickness, Texture2D Tex) { SBS.StereoTexture(new Rect(Left, Top, Width, Thickness), Tex); SBS.StereoTexture(new Rect(Left, Top, Thickness, Height), Tex); SBS.StereoTexture(new Rect(Left, Top + Height - Thickness, Width, Thickness), Tex); SBS.StereoTexture(new Rect(Left + Width - Thickness, Top, Thickness, Height), Tex); }
void OnGUI() { if (Lives == 0) // Game over { return; } // Weapon and health bars GUI.skin.label.fontStyle = FontStyle.BoldAndItalic; GUI.skin.label.fontSize = Screen.height / 32; int Margin = Screen.height / 20, BarLeft = Screen.width - 8 * Margin, BarTop = Screen.height - 2 * Margin, BarWidth = 7 * Margin, Thickness = Screen.height / 200, MpT = Margin + Thickness; Utilities.GUIRectangle(Margin, BarTop, BarWidth, Margin, Thickness, GUIColor); Utilities.GUIRectangle(BarLeft, BarTop, BarWidth, Margin, Thickness, GUIColor); BarWidth -= 2 * Thickness; SBS.StereoTexture(new Rect(MpT, BarTop, Weapon.Level == 5 ? BarWidth : (BarWidth * Weapon.XP / 25), Margin), GUITransparency); GUI.skin.label.alignment = TextAnchor.MiddleLeft; SBS.StereoLabel(new Rect(MpT + 10, BarTop, BarWidth, Margin), "LEVEL " + Weapon.Level + " " + Weapon.DisplayName); SBS.StereoTexture(new Rect(BarLeft + Thickness, BarTop, BarWidth * Health / 100, Margin), GUITransparency); GUI.skin.label.alignment = TextAnchor.MiddleRight; SBS.StereoLabel(new Rect(BarLeft - 10, BarTop, BarWidth, Margin), "LIVES: " + Lives); // Score GUI.skin.label.fontSize *= 2; GUI.skin.label.alignment = TextAnchor.LowerCenter; SBS.StereoLabel(new Rect(0, 0, Screen.width, BarTop + Margin), Score.ToString()); }
/// <summary> /// Now playing popup. /// </summary> void OnGUI() { if (DisplayTime > 0) { float Fade = Mathf.Min(1 - Mathf.Abs(DisplayTime - 2), 0) * 400; DisplayTime -= Time.deltaTime * .5f; SBS.StereoTexture(new Rect(Fade, 100, 200, 50), OuterTexture); SBS.StereoTexture(new Rect(Fade, 102, 198, 46), InnerTexture); GUI.skin.label.alignment = TextAnchor.MiddleCenter; GUI.skin.label.fontSize = 14; GUI.skin.label.fontStyle = FontStyle.Italic; SBS.StereoLabel(new Rect(Fade, 105, 200, 20), Artist); GUI.skin.label.fontStyle = FontStyle.BoldAndItalic; SBS.StereoLabel(new Rect(Fade, 125, 200, 20), Song); } }