네트워크 멀티플레이 대응

This commit is contained in:
2026-01-31 20:49:23 +09:00
parent 1152093521
commit c5bcf265d0
69 changed files with 2766 additions and 1392 deletions

View File

@@ -0,0 +1,55 @@
using Unity.Netcode;
using UnityEngine;
namespace Northbound
{
public static class NetworkSpawnHelper
{
public static void AddFogOfWarVisibility(GameObject obj, bool showInExploredAreas = true, float updateInterval = 0.2f)
{
if (obj.GetComponent<FogOfWarVisibility>() == null)
{
var visibility = obj.AddComponent<FogOfWarVisibility>();
visibility.showInExploredAreas = showInExploredAreas;
visibility.updateInterval = updateInterval;
}
}
public static void PreparePreviewForRendering(GameObject preview)
{
NetworkObject netObj = preview.GetComponent<NetworkObject>();
if (netObj != null)
{
Object.DestroyImmediate(netObj);
}
Building building = preview.GetComponent<Building>();
if (building != null)
{
Object.DestroyImmediate(building);
}
}
public static void ApplyMaterialToPreview(GameObject preview, Material material)
{
Renderer[] renderers = preview.GetComponentsInChildren<Renderer>();
foreach (var renderer in renderers)
{
Material[] mats = new Material[renderer.materials.Length];
for (int i = 0; i < mats.Length; i++)
{
mats[i] = material;
}
renderer.materials = mats;
}
}
public static void DisableColliders(GameObject obj)
{
foreach (var collider in obj.GetComponentsInChildren<Collider>())
{
collider.enabled = false;
}
}
}
}