void OnGUI() { if (canShoot || canSpecialShot) { quiver.GUIDisplay(currentAmmo); } float minWidth = 0.20f; int graphicalHorizontalOffset = 30; int horizontalOffset = 12; int verticalOffset = 50; int boxWidth = 50; int boxHeight = 20; #region Death GUI if (isDead) { GUIStyle style = new GUIStyle(); style.fontSize = 16; style.normal.textColor = new Color(1, 0, 0); string deathMessage = "You have died. Respawn in"; float deathCooldown = respawnDelay - respawnTimer; deathCooldown = (deathCooldown <= 0) ? 0 : deathCooldown; string deathCooldownString = deathCooldown.ToString("F2") + " seconds"; GUI.Label(new Rect(Screen.width / 2 - (graphicalHorizontalOffset * 2), Screen.height / 2 + (verticalOffset / 2), 300, 100), deathMessage, style); GUI.Label(new Rect(Screen.width / 2 - horizontalOffset, Screen.height / 2 + verticalOffset, 300, 100), deathCooldownString, style); } #endregion #region ShootGUI if (shotTimer < bow.getReloadDelay()) { if (!arrowOnCooldown) { arrowDisplay = new Rect(Screen.width / 2 - graphicalHorizontalOffset, (Screen.height / 2) - verticalOffset, boxWidth, boxHeight / 2); arrowOnCooldown = true; } //Graphical Cooldown arrowDisplay.width = (boxWidth) * (((bow.getReloadDelay() - shotTimer) / bow.getReloadDelay()) + minWidth); GUI.Box(arrowDisplay, ""); //Numerical Cooldown string cooldown = (bow.getReloadDelay() - shotTimer).ToString("F2"); GUI.Label(new Rect(Screen.width / 2 - horizontalOffset, (Screen.height / 2) - (verticalOffset + 5), boxWidth, boxHeight), cooldown); } else { arrowOnCooldown = false; } #endregion #region DashGUI if (abilityCooldown > 0) { abilityDisplay = new Rect(Screen.width / 2 - graphicalHorizontalOffset, (Screen.height / 2) - verticalOffset / 4, boxWidth, boxHeight / 2); //Graphical Cooldown abilityDisplay.width = (boxWidth) * ((abilityCooldown / 4) + minWidth); GUI.Box(abilityDisplay, ""); //Numerical Cooldown string abilityCooldownText = abilityCooldown.ToString("F2"); GUI.Label(new Rect(Screen.width / 2 - horizontalOffset, (Screen.height / 2) - (verticalOffset / 4 + 4), boxWidth, boxHeight), abilityCooldownText); } #endregion }