60 lines
1.5 KiB
C#
60 lines
1.5 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace BlueWaterProject
|
|
{
|
|
public class BossPortal : MonoBehaviour
|
|
{
|
|
[SerializeField] private GameObject playerSpawnPosObj;
|
|
[SerializeField] private FieldBoss fieldBoss;
|
|
|
|
private Collider[] bossEntrances;
|
|
|
|
private bool isIn;
|
|
|
|
private void Awake()
|
|
{
|
|
var bossEntrance = transform.Find("BossEntrance");
|
|
if (!bossEntrance)
|
|
{
|
|
print("BossEntrance 오브젝트가 null입니다.");
|
|
}
|
|
else
|
|
{
|
|
bossEntrances = bossEntrance.GetComponentsInChildren<Collider>();
|
|
}
|
|
|
|
BossEntranceSetActive(false);
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (isIn || !other.CompareTag("InIslandPlayer")) return;
|
|
|
|
// TODO : 보스 맵 입장
|
|
isIn = true;
|
|
other.transform.position = playerSpawnPosObj.transform.position;
|
|
BossEntranceSetActive(true);
|
|
|
|
fieldBoss.BossSpawn(other);
|
|
fieldBoss.Target = other;
|
|
}
|
|
|
|
private void BossEntranceSetActive(bool value)
|
|
{
|
|
foreach (var entrance in bossEntrances)
|
|
{
|
|
entrance.gameObject.SetActive(value);
|
|
}
|
|
}
|
|
|
|
private void BossReset()
|
|
{
|
|
fieldBoss.gameObject.SetActive(false);
|
|
BossEntranceSetActive(false);
|
|
|
|
isIn = false;
|
|
}
|
|
}
|
|
} |