2024-06-03 18:26:03 +00:00
|
|
|
using System.Collections;
|
|
|
|
using BlueWater.Uis;
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace BlueWater.Maps
|
|
|
|
{
|
|
|
|
public abstract class MapController : MonoBehaviour
|
|
|
|
{
|
|
|
|
/// 컴포넌트
|
|
|
|
[Title("컴포넌트")]
|
|
|
|
[SerializeField, Required]
|
|
|
|
protected Transform PlayerSpawnTransform;
|
|
|
|
|
|
|
|
[SerializeField, Required]
|
|
|
|
public Transform EnemyInstantiateLocation;
|
|
|
|
|
|
|
|
[field: SerializeField]
|
|
|
|
public Transform ParticleInstantiateLocation { get; private set; }
|
2024-06-13 16:46:37 +00:00
|
|
|
|
|
|
|
[SerializeField]
|
|
|
|
protected SaveStage SaveStage;
|
|
|
|
|
|
|
|
[SerializeField]
|
|
|
|
protected string BGMName;
|
2024-06-03 18:26:03 +00:00
|
|
|
|
|
|
|
public abstract void InitializeMap();
|
|
|
|
|
|
|
|
// TODO : FieldMinion 생성 후 연결
|
|
|
|
// protected T InstantiateFieldMinion<T>(Vector3 instantiatePosition, T prefab) where T : FieldMinion
|
|
|
|
// {
|
|
|
|
// var instantiateFieldMinion = Instantiate(prefab, instantiatePosition, Quaternion.identity, EnemyInstantiateLocation).GetComponent<T>();
|
|
|
|
// instantiateFieldMinion.Init(this);
|
|
|
|
//
|
|
|
|
// EnemyInstanceList.Add(instantiateFieldMinion.gameObject);
|
|
|
|
//
|
|
|
|
// return instantiateFieldMinion;
|
|
|
|
// }
|
|
|
|
|
|
|
|
public void AllDestroyEnemy()
|
|
|
|
{
|
|
|
|
foreach (Transform element in EnemyInstantiateLocation)
|
|
|
|
{
|
|
|
|
Destroy(element.gameObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void AllDestroyObjects()
|
|
|
|
{
|
|
|
|
foreach (Transform element in EnemyInstantiateLocation)
|
|
|
|
{
|
|
|
|
Destroy(element.gameObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (Transform element in ParticleInstantiateLocation)
|
|
|
|
{
|
|
|
|
Destroy(element.gameObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public virtual void MapClear()
|
|
|
|
{
|
|
|
|
if (EnemyInstantiateLocation.childCount <= 0)
|
|
|
|
{
|
|
|
|
StartCoroutine(nameof(MapClearCoroutine));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private IEnumerator MapClearCoroutine()
|
|
|
|
{
|
|
|
|
VisualFeedbackManager.Instance.SetBaseTimeScale(0.1f);
|
|
|
|
CombatUiManager.Instance.FadeInOut();
|
|
|
|
|
|
|
|
var elapsedTime = 0f;
|
|
|
|
while (elapsedTime <= 3f)
|
|
|
|
{
|
|
|
|
elapsedTime += Time.unscaledDeltaTime;
|
|
|
|
yield return null;
|
|
|
|
}
|
|
|
|
AllDestroyEnemy();
|
|
|
|
VisualFeedbackManager.Instance.SetBaseTimeScale(1f);
|
|
|
|
|
|
|
|
elapsedTime = 0f;
|
|
|
|
while (elapsedTime <= 2f)
|
|
|
|
{
|
|
|
|
elapsedTime += Time.unscaledDeltaTime;
|
|
|
|
yield return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
MapClear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|