Bug Fixes
This commit is contained in:
@@ -38,6 +38,11 @@ public class GhostRoundManager : MonoBehaviour
|
||||
{
|
||||
if (!IsServer) return;
|
||||
|
||||
// Убираем клонов прошлого раунда (их специально оставили висеть на экране победы)
|
||||
foreach (GhostPlayer _ghost in activeGhosts)
|
||||
if (_ghost != null && _ghost.IsSpawned)
|
||||
_ghost.NetworkObject.Despawn();
|
||||
|
||||
roundTick = 0;
|
||||
activeGhosts.Clear();
|
||||
|
||||
@@ -48,6 +53,8 @@ public class GhostRoundManager : MonoBehaviour
|
||||
{
|
||||
if (_recording.positions.Count == 0) continue;
|
||||
|
||||
Debug.Log($"[GHOST] spawn clone owner={_recording.ownerClientId} at positions[0]={_recording.positions[0]} ticks={_recording.positions.Count} last={_recording.positions[_recording.positions.Count - 1]}");
|
||||
|
||||
GameObject _go = Instantiate(ghostPrefab, _recording.positions[0], _recording.rotations[0]);
|
||||
_go.GetComponent<NetworkObject>().Spawn();
|
||||
|
||||
@@ -93,13 +100,8 @@ public class GhostRoundManager : MonoBehaviour
|
||||
if (!IsServer || !roundRunning) return;
|
||||
roundRunning = false;
|
||||
|
||||
// Убираем клонов со сцены
|
||||
foreach (GhostPlayer _ghost in activeGhosts)
|
||||
{
|
||||
if (_ghost != null && _ghost.IsSpawned)
|
||||
_ghost.NetworkObject.Despawn();
|
||||
}
|
||||
activeGhosts.Clear();
|
||||
// Клонов НЕ убираем здесь — пусть остаются (замирают, т.к. roundRunning=false)
|
||||
// на экране победы. Деспавн происходит в начале ServerStartRound перед спавном новых.
|
||||
|
||||
// Останавливаем запись и складываем раунд в архив
|
||||
foreach (NetworkClient _client in NetworkManager.Singleton.ConnectedClientsList)
|
||||
@@ -115,6 +117,12 @@ public class GhostRoundManager : MonoBehaviour
|
||||
archive[_client.ClientId] = _list;
|
||||
}
|
||||
|
||||
GhostRecording _rec = _recorder.Recording;
|
||||
if (_rec.positions.Count > 0)
|
||||
Debug.Log($"[GHOST] archive owner={_client.ClientId} ticks={_rec.positions.Count} first={_rec.positions[0]} last={_rec.positions[_rec.positions.Count - 1]}");
|
||||
else
|
||||
Debug.LogWarning($"[GHOST] archive owner={_client.ClientId} EMPTY recording (0 ticks)");
|
||||
|
||||
_list.Add(_recorder.Recording);
|
||||
if (_list.Count > maxGhostsPerPlayer) _list.RemoveAt(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user