using UnityEngine; public sealed class InspectorConfig : MonoBehaviour { [SerializeField, Min(0)] private int startingAmmo = 3; private int currentAmmo; private void OnValidate() { if (startingAmmo < 0) startingAmmo = 0; } private void Awake() { currentAmmo = Mathf.Max(0, startingAmmo); } [ContextMenu("Use One Round")] public void UseOneRound() { if (!Application.isPlaying) { Debug.LogWarning("Enter Play mode first.", this); return; } currentAmmo = Mathf.Max(0, currentAmmo - 1); Debug.Log("Current ammo: " + currentAmmo, this); } }