diff --git a/Assets/Scripts/PlayerShooting.cs b/Assets/Scripts/PlayerShooting.cs index 5817839..e6e88d3 100644 --- a/Assets/Scripts/PlayerShooting.cs +++ b/Assets/Scripts/PlayerShooting.cs @@ -1,6 +1,7 @@ using System.Collections; using UnityEngine; -using UnityEngine.UI; +// ИЗМЕНЕНО: Используем пространство имен для TextMeshPro +using TMPro; public class PlayerShooting : MonoBehaviour { @@ -18,7 +19,8 @@ public class PlayerShooting : MonoBehaviour // --- Ссылки на компоненты и объекты --- public GameObject muzzleFlashSprite; - public Text ammoText; + // ИЗМЕНЕНО: Тип переменной заменен на TextMeshProUGUI + public TextMeshProUGUI ammoText; public AudioClip reloadSound; private float timer; @@ -80,7 +82,7 @@ public class PlayerShooting : MonoBehaviour currentAmmo--; UpdateAmmoText(); - gunAudio.Play(); + gunAudio.Play(); gunParticles.Stop(); gunParticles.Play(); @@ -130,7 +132,7 @@ public class PlayerShooting : MonoBehaviour IEnumerator Reload() { isReloading = true; - + if (reloadSound != null) { gunAudio.PlayOneShot(reloadSound); @@ -149,6 +151,7 @@ public class PlayerShooting : MonoBehaviour { if (ammoText != null) { + // Для TextMeshPro синтаксис точно такой же, так что здесь ничего менять не нужно ammoText.text = "Патроны: " + currentAmmo + " / " + maxAmmo; } }