Files
ZeroVR/ZeroPacientVR/Assets/Scripts/WeaponCountAmmoUI.cs
T
2022-04-18 19:17:20 +03:00

26 lines
559 B
C#

using HurricaneVR.Framework.Weapons.Guns;
using TMPro;
using UnityEngine;
public class WeaponCountAmmoUI : MonoBehaviour
{
[SerializeField] private HVRGunBase gun;
[SerializeField] private TMP_Text countText;
private int cachedCount = -1;
private void Update()
{
var count = 0;
if (gun != null && gun.Ammo != null)
{
count = gun.Ammo.CurrentCount;
}
if (count != cachedCount)
{
cachedCount = count;
countText.text = count.ToString();
}
}
}