hello i am making a fps game and i was wondering how would I make it so it has a set number of ammo and a gui displaying the ammo count on the screen. in other words how to i make a gui and ammo count.
var bulletHudTexture : Texture; //bullet display texture
var ammoCountRect : Rect = Rect(25,25,50,25);
var ammoStartX : int = 100;
var ammoY : int = 25;
var ammoSize : Vector2 = Vector2(2.316,15);
var ammoSpacing : float = 3;
function OnGUI ()
{
if (beingHeld)
{
for (var i : int = 1; i <= currentClip; i++)
{
GUI.DrawTexture(Rect(ammoStartX + ((i - 1) * (ammoSize.x + ammoSpacing)), ammoY, ammoSize.x, ammoSize.y), bulletHudTexture);
}
GUI.Label(ammoCountRect, currentClip.ToString() + "/" + currentExtraAmmo.ToString());
}
}