88 lines
2.3 KiB
C#
88 lines
2.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BlueWaterProject;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
public abstract class BossMapController : MonoBehaviour
|
|
{
|
|
/// 컴포넌트
|
|
[Title("컴포넌트")]
|
|
[SerializeField, Required] protected Transform playerSpawnTransform;
|
|
[SerializeField, Required] protected Transform bossSpawnTransform;
|
|
[SerializeField, Required] protected Transform bossInstantiateTransform;
|
|
[SerializeField, Required] protected GameObject bossPrefab;
|
|
[field: SerializeField] public Transform ParticleInstantiateLocation { get; private set; }
|
|
|
|
protected List<GameObject> bossInstanceList = new(10);
|
|
|
|
public virtual void InitBossMap()
|
|
{
|
|
AllDestroyObjects();
|
|
bossInstanceList = new List<GameObject>(10);
|
|
|
|
if (GameManager.Inst)
|
|
{
|
|
var player = GameManager.Inst.CurrentCombatPlayer;
|
|
if (player)
|
|
{
|
|
Destroy(player.gameObject);
|
|
}
|
|
|
|
GameManager.Inst.InstantiateCombatPlayer(playerSpawnTransform.position);
|
|
}
|
|
|
|
// 보스 override로 추가
|
|
}
|
|
|
|
public void AllDestroyBoss()
|
|
{
|
|
foreach (var element in bossInstanceList)
|
|
{
|
|
Destroy(element);
|
|
}
|
|
}
|
|
|
|
public void AllDestroyObjects()
|
|
{
|
|
foreach (var element in bossInstanceList)
|
|
{
|
|
Destroy(element);
|
|
}
|
|
|
|
foreach (Transform element in ParticleInstantiateLocation)
|
|
{
|
|
Destroy(element.gameObject);
|
|
}
|
|
}
|
|
|
|
public virtual void DieBoss()
|
|
{
|
|
StartCoroutine(nameof(DieBossCoroutine));
|
|
}
|
|
|
|
private IEnumerator DieBossCoroutine()
|
|
{
|
|
VisualFeedbackManager.Inst.SetBaseTimeScale(0.1f);
|
|
CombatUiManager.Inst.FadeInOut();
|
|
|
|
var elapsedTime = 0f;
|
|
while (elapsedTime <= 3f)
|
|
{
|
|
elapsedTime += Time.unscaledDeltaTime;
|
|
yield return null;
|
|
}
|
|
AllDestroyBoss();
|
|
VisualFeedbackManager.Inst.SetBaseTimeScale(1f);
|
|
|
|
elapsedTime = 0f;
|
|
while (elapsedTime <= 2f)
|
|
{
|
|
elapsedTime += Time.unscaledDeltaTime;
|
|
yield return null;
|
|
}
|
|
|
|
CombatUiManager.Inst.ClearPopupUi.Open();
|
|
}
|
|
} |