8298b2559c
1. 게임형태 변경 - Game스텝에서 기존 1단계, 2단계 수정(회전만 가능하게). - ShootButton을 만들어 플레이어도 총알을 쏠수 있도록 수정. - Bullet, BulletSpawner, PlayerController를 수정 - SpawnZone을 생성하여 기존 고정이던 스포너를 랜덤으로 생성. 2. 오류 수정 - 모바일 버전 시 플레이어가 한방향만 보던 형상 수정. - 펜스에서 플레이어 캐릭터가 닿으면 회전하던 형상 수정.
42 lines
903 B
C#
42 lines
903 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
|
|
public class ShootButtonUI : MonoBehaviour
|
|
{
|
|
[Header("References")]
|
|
public TMP_Text ammoText;
|
|
|
|
private ShootButton shootButton;
|
|
private int lastCurrent;
|
|
private int lastMax;
|
|
|
|
void Awake()
|
|
{
|
|
shootButton = GetComponent<ShootButton>();
|
|
}
|
|
|
|
public void UpdateAmmoUI(int current, int max)
|
|
{
|
|
lastCurrent = current;
|
|
lastMax = max;
|
|
|
|
if (ammoText != null)
|
|
ammoText.text = $"{current}/{max}";
|
|
}
|
|
|
|
public void SetReloading(bool reloading)
|
|
{
|
|
if (ammoText != null)
|
|
{
|
|
if (reloading)
|
|
ammoText.text = "Reload";
|
|
else
|
|
ammoText.text = $"{lastCurrent}/{lastMax}";
|
|
}
|
|
|
|
// 버튼 입력 차단/해제
|
|
if (shootButton != null)
|
|
shootButton.SetDisabled(reloading);
|
|
}
|
|
} |