Visualizing ammo count in screen in form of current and max

Jaime
Jun 17, 2021

--

Previously, the ammo left is visualized through text. This time around we will visualize ammo in form of current and max with sprites.

I will use delegates again to signal each ammo if it should still keep its current state or swap images whether it should show if it has ammo or not:

As you can se above, it depends on the value of _id and _hasAmmo if its sprite will be swapped or not.

In the UpdateScore() of UIManager I added call to Update the sprite:

public static Action<int, Sprite[]> UpdateAmmoSprite;private void UpdateAmmo(int ammo)
{
_ammoText.text = "Ammo: " + ammo;
UpdateAmmoSprite(ammo, _ammoSprites);
}

Now, I can visualize ammo remaining via text or image.

--

--

Jaime
Jaime

No responses yet