캐릭터 움직임 및 애니메이션
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user