캐릭터 움직임 및 애니메이션
This commit is contained in:
45
Assets/Scripts/Network/NetworkLauncher.cs
Normal file
45
Assets/Scripts/Network/NetworkLauncher.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using UnityEngine;
|
||||
using Unity.Netcode;
|
||||
|
||||
namespace Colosseum.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// 네트워크 연결 관리 (Host/Client 시작)
|
||||
/// </summary>
|
||||
public class NetworkLauncher : MonoBehaviour
|
||||
{
|
||||
[Header("UI References")]
|
||||
[SerializeField] private GameObject connectionUI;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// 게임 시작 시 UI 표시
|
||||
if (connectionUI != null)
|
||||
connectionUI.SetActive(true);
|
||||
}
|
||||
|
||||
public void StartHost()
|
||||
{
|
||||
NetworkManager.Singleton.StartHost();
|
||||
HideConnectionUI();
|
||||
}
|
||||
|
||||
public void StartClient()
|
||||
{
|
||||
NetworkManager.Singleton.StartClient();
|
||||
HideConnectionUI();
|
||||
}
|
||||
|
||||
public void StartServer()
|
||||
{
|
||||
NetworkManager.Singleton.StartServer();
|
||||
HideConnectionUI();
|
||||
}
|
||||
|
||||
private void HideConnectionUI()
|
||||
{
|
||||
if (connectionUI != null)
|
||||
connectionUI.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Network/NetworkLauncher.cs.meta
Normal file
2
Assets/Scripts/Network/NetworkLauncher.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a94a6fa23cedaf545aea2b1057800149
|
||||
56
Assets/Scripts/Network/PlayerSpawnPoint.cs
Normal file
56
Assets/Scripts/Network/PlayerSpawnPoint.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// 플레이어 스폰 위치 마커
|
||||
/// 씬에 배치하여 플레이어가 스폰될 위치를 지정
|
||||
/// </summary>
|
||||
public class PlayerSpawnPoint : MonoBehaviour
|
||||
{
|
||||
[Header("Spawn Settings")]
|
||||
[SerializeField] private bool useRotation = true;
|
||||
|
||||
private static System.Collections.Generic.List<PlayerSpawnPoint> spawnPoints = new System.Collections.Generic.List<PlayerSpawnPoint>();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
spawnPoints.Add(this);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
spawnPoints.Remove(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 사용 가능한 스폰 포인트 중 하나를 반환
|
||||
/// </summary>
|
||||
public static Transform GetRandomSpawnPoint()
|
||||
{
|
||||
if (spawnPoints.Count == 0)
|
||||
return null;
|
||||
|
||||
int index = Random.Range(0, spawnPoints.Count);
|
||||
return spawnPoints[index].transform;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 스폰 포인트 개수 반환
|
||||
/// </summary>
|
||||
public static int SpawnPointCount => spawnPoints.Count;
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.color = Color.green;
|
||||
Gizmos.DrawWireSphere(transform.position, 0.5f);
|
||||
Gizmos.color = Color.blue;
|
||||
Gizmos.DrawLine(transform.position, transform.position + transform.forward * 1.5f);
|
||||
|
||||
// 화살표 머리
|
||||
Vector3 arrowPos = transform.position + transform.forward * 1.5f;
|
||||
Gizmos.DrawLine(arrowPos, arrowPos - transform.forward * 0.3f + transform.right * 0.2f);
|
||||
Gizmos.DrawLine(arrowPos, arrowPos - transform.forward * 0.3f - transform.right * 0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Network/PlayerSpawnPoint.cs.meta
Normal file
2
Assets/Scripts/Network/PlayerSpawnPoint.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aba9a2eb2571da14d901ed51c8866f47
|
||||
Reference in New Issue
Block a user