완
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
@@ -5,7 +6,9 @@ using UnityEngine;
|
||||
using Photon.Pun;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using Hashtable = ExitGames.Client.Photon.Hashtable;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class GameManager : MonoBehaviourPunCallbacks
|
||||
{
|
||||
@@ -13,6 +16,10 @@ public class GameManager : MonoBehaviourPunCallbacks
|
||||
public GameObject readyPanel;
|
||||
public GameObject restartButton;
|
||||
public GameObject destroyRoomButton;
|
||||
public GameObject map;
|
||||
|
||||
private Image _image;
|
||||
private float _fillAmount = 1f;
|
||||
|
||||
public static Dictionary<int, Sprite> AvatarCache = new Dictionary<int, Sprite>();
|
||||
|
||||
@@ -20,6 +27,7 @@ public class GameManager : MonoBehaviourPunCallbacks
|
||||
{
|
||||
if (restartButton != null) restartButton.SetActive(false);
|
||||
if (destroyRoomButton != null) destroyRoomButton.SetActive(false); // [추가]
|
||||
_image = map.GetComponent<Image>();
|
||||
// 씬 시작 시, 모두의 아바타를 다운로드하는 코루틴 시작
|
||||
StartCoroutine(DownloadAllAvatarsAndReady());
|
||||
}
|
||||
@@ -58,7 +66,7 @@ public class GameManager : MonoBehaviourPunCallbacks
|
||||
|
||||
if (request.result != UnityWebRequest.Result.Success)
|
||||
{
|
||||
Debug.LogError($"[다운로드 실패] 유저 번호: {actorNumber}, 에러: {request.error}");
|
||||
Debug.LogError($"[다운로드 실패] 유저 번호: {actorNumber}, 에러: {request.error}\nwhile Downloading {url}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -88,6 +96,13 @@ public class GameManager : MonoBehaviourPunCallbacks
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!Gazuaa.isGameActive) return;
|
||||
_fillAmount -= Time.deltaTime;
|
||||
_image.fillAmount = _fillAmount / 15f; // 15초 동안 서서히 줄어들도록 설정
|
||||
}
|
||||
|
||||
private bool CheckAllPlayersLoaded()
|
||||
{
|
||||
// 방에 있는 모든 플레이어의 "IsLoaded"가 true인지 확인
|
||||
@@ -116,6 +131,7 @@ public class GameManager : MonoBehaviourPunCallbacks
|
||||
|
||||
private IEnumerator GameSet()
|
||||
{
|
||||
_fillAmount = 15;
|
||||
// 1. 카운트다운
|
||||
text.text = "3";
|
||||
yield return new WaitForSeconds(1f);
|
||||
@@ -129,7 +145,6 @@ public class GameManager : MonoBehaviourPunCallbacks
|
||||
|
||||
// --- 게임 시작 ---
|
||||
Gazuaa.isGameActive = true; // 스페이스바 입력 활성화!
|
||||
|
||||
// 2. 15초 동안 게임 진행 (대기)
|
||||
yield return new WaitForSeconds(15f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user