게이트 이동 시스템 추가 및 기존 이동 매니저 정리
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GateOpenZone : MonoBehaviour
|
||||
{
|
||||
[Header("게이트 오픈 관리자")]
|
||||
[SerializeField] private RoomClearGateController roomClearGateController;
|
||||
|
||||
[Header("Player Check")]
|
||||
[SerializeField] private string playerTag = "Player";
|
||||
|
||||
private bool used = false;
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (used)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsPlayer(other))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (roomClearGateController == null)
|
||||
{
|
||||
Debug.LogWarning("RoomClearGateController가 연결되지 않았습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!roomClearGateController.IsRoomCleared)
|
||||
{
|
||||
Debug.Log("아직 방 클리어 전입니다. 게이트를 열지 않습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
used = true;
|
||||
roomClearGateController.OpenClearGate();
|
||||
}
|
||||
|
||||
private bool IsPlayer(Collider other)
|
||||
{
|
||||
if (other.CompareTag(playerTag))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (other.transform.root.CompareTag(playerTag))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user