счетчик оставшихся патронов, который
уменьшается при каждом выстреле.
This commit is contained in:
1 parent
c9085558cd
commit
87aaf3139a
1 file changed
+5
-2
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
// ИЗМЕНЕНО: Используем пространство имен для TextMeshPro
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
public class PlayerShooting : MonoBehaviour
|
public class PlayerShooting : MonoBehaviour
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,8 @@ public class PlayerShooting : MonoBehaviour
|
|||||||
|
|
||||||
// --- Ссылки на компоненты и объекты ---
|
// --- Ссылки на компоненты и объекты ---
|
||||||
public GameObject muzzleFlashSprite;
|
public GameObject muzzleFlashSprite;
|
||||||
public Text ammoText;
|
// ИЗМЕНЕНО: Тип переменной заменен на TextMeshProUGUI
|
||||||
|
public TextMeshProUGUI ammoText;
|
||||||
public AudioClip reloadSound;
|
public AudioClip reloadSound;
|
||||||
|
|
||||||
private float timer;
|
private float timer;
|
||||||
@@ -149,6 +151,7 @@ public class PlayerShooting : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (ammoText != null)
|
if (ammoText != null)
|
||||||
{
|
{
|
||||||
|
// Для TextMeshPro синтаксис точно такой же, так что здесь ничего менять не нужно
|
||||||
ammoText.text = "Патроны: " + currentAmmo + " / " + maxAmmo;
|
ammoText.text = "Патроны: " + currentAmmo + " / " + maxAmmo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user