public override void OnSwitchOnTo()
        {
            if (isLocalClient)
            {
                if (!HudAmmoControls.HasValue)
                {
                    return;
                }

                HudAmmoControls controls = HudAmmoControls.Value;

                controls.ammoText.gameObject.SetActive(true);
                controls.maxAmmoText.gameObject.SetActive(true);
                controls.reloadTextGameObject.gameObject.SetActive(isReloading);
            }

            if (!isServer)
            {
                return;
            }

            //Start reloading again if we switch to and we our out of projectiles
            if (currentProjectileCount <= 0)
            {
                OnReload();
            }

            UpdateUI();
        }
        public override void OnUIUpdate(IHudUpdateMessage hudUpdateMessage)
        {
            if (hudUpdateMessage is DefaultHudUpdateMessage defaultHudUpdateMessage)
            {
                if (!HudAmmoControls.HasValue)
                {
                    return;
                }

                HudAmmoControls controls = HudAmmoControls.Value;

                controls.ammoText.text    = defaultHudUpdateMessage.CurrentBullets.ToString();
                controls.maxAmmoText.text = maxWeaponProjectileCount.ToString();
                controls.reloadTextGameObject.SetActive(defaultHudUpdateMessage.IsReloading);

                isReloading = defaultHudUpdateMessage.IsReloading;
            }
        }
        public override void OnSwitchOff()
        {
            if (isLocalClient)
            {
                if (!HudAmmoControls.HasValue)
                {
                    return;
                }

                HudAmmoControls controls = HudAmmoControls.Value;

                controls.ammoText.gameObject.SetActive(false);
                controls.maxAmmoText.gameObject.SetActive(false);
                controls.reloadTextGameObject.gameObject.SetActive(false);
            }

            if (!isServer)
            {
                return;
            }

            CancelReload();
            shootRepeatedlyCancellation?.Cancel();
        }