I am working on a health bar, mana bar, and energy bar. This is my script
using UnityEngine;
using System.Collections;
public class Bars : MonoBehaviour {
public bool isPercentage;
void OnGUI() {
HealthBar();
ManaBar();
EnergyBar();
}
private void HealthBar() {
if(isPercentage == true) {
GUI.Label(new Rect(85, 15, 100, 20), "100%");
}
else
{
GUI.Label(new Rect(85, 10, 100, 20), "/100");
}
}
private void ManaBar() {
if(isPercentage == true) {
GUI.Label(new Rect(90, 50, 100, 20), "100%");
}
else
{
GUI.Label(new Rect(90, 50, 100, 20), "/100");
}
}
private void EnergyBar() {
if(isPercentage == true) {
GUI.Label(new Rect(90, 75, 100, 20), "100%");
}
else
{
GUI.Label(new Rect(90, 75, 100, 20), "/100");
}
}
}
The only problem is that when i make isPercentage False than it shows both 100% and /100
NOTE: i do know that the script isn't complete right now im just working on labeling it than i will go into coding it when i get damage the percentage or fraction will go down...
Thanks in advanced to anyone who helps me with this
NOTE2: I will except someone changing it to javascript im good with both but im more familiar with c#