+ AiMovement 클래스 재생성 및 초기화 방식 변경 + AnimationController 클래스 초기화 방식 변경 + MapManager, MapController 로직 수정 + BaseBoss 프리팹 수정 + SandMole 보스에 맞게 맵 추가 + 임시 SandMole, GhostBarrel 이미지 추가 + 기존 GroundGreen, GroundRed 스프라이트 정사각형으로 변경, 수정에 따라 BaseMapController Ground, Wall 수정 + 코뿔소 맵 투명화 Props 추가 Closes #12
181 lines
5.8 KiB
C#
181 lines
5.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BlueWater.Items;
|
|
using BlueWater.Maps;
|
|
using DG.Tweening;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine.UI;
|
|
|
|
namespace BlueWater.Uis
|
|
{
|
|
public class CombatUiManager : Singleton<CombatUiManager>
|
|
{
|
|
[field: Title("UI")]
|
|
[field: SerializeField]
|
|
public Canvas MainCanvas { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public Canvas WorldSpaceCanvas { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public CombatSkillUi CombatSkillUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public FieldBossHealthPointUi FieldBossHealthPointUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public PlayerHealthPointUi PlayerHealthPointUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public ItemLootUi ItemLootUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public CombatItemInventoryUi CombatItemInventoryUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public GameOverPopupUi GameOverPopupUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public ClearPopupUi ClearPopupUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public MenuPopupUi CombatMenuPopupUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public CombatTutorialUi CombatTutorialUi { get; private set; }
|
|
|
|
[SerializeField]
|
|
private Image _fadeImage;
|
|
|
|
[Title("효과")]
|
|
[SerializeField]
|
|
private Vector2 _fadeInOutDuration = new(0.2f, 0.3f);
|
|
|
|
public List<PopupUi> PopupUiList { get; private set; }
|
|
|
|
protected override void OnAwake()
|
|
{
|
|
InitializeComponents();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
PopupUi.OnPopupUiOpenEvent += RegisterPopup;
|
|
PopupUi.OnPopupUiCloseEvent += UnregisterPopup;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
CombatTutorialUi.ShowFirstTutorialUi();
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
PopupUi.OnPopupUiOpenEvent -= RegisterPopup;
|
|
PopupUi.OnPopupUiCloseEvent -= UnregisterPopup;
|
|
}
|
|
|
|
[Button("셋팅 초기화")]
|
|
private void InitializeComponents()
|
|
{
|
|
MainCanvas = GetComponent<Canvas>();
|
|
WorldSpaceCanvas = GameObject.Find("WorldSpaceCanvas").GetComponent<Canvas>();
|
|
CombatSkillUi = MainCanvas.transform.Find("CombatSkillUi").GetComponent<CombatSkillUi>();
|
|
FieldBossHealthPointUi = MainCanvas.transform.Find("FieldBossHealthPointUi").GetComponent<FieldBossHealthPointUi>();
|
|
PlayerHealthPointUi = MainCanvas.transform.Find("PlayerHealthPointUi").GetComponent<PlayerHealthPointUi>();
|
|
ItemLootUi = MainCanvas.transform.Find("ItemLootUi").GetComponent<ItemLootUi>();
|
|
CombatItemInventoryUi = MainCanvas.transform.Find("CombatItemInventoryUi").GetComponent<CombatItemInventoryUi>();
|
|
GameOverPopupUi = MainCanvas.transform.Find("GameOverPopupUi").GetComponent<GameOverPopupUi>();
|
|
ClearPopupUi = MainCanvas.transform.Find("ClearPopupUi").GetComponent<ClearPopupUi>();
|
|
CombatMenuPopupUi = MainCanvas.transform.Find("CombatMenuPopupUi").GetComponent<MenuPopupUi>();
|
|
CombatTutorialUi = MainCanvas.transform.Find("CombatTutorialUi").GetComponent<CombatTutorialUi>();
|
|
_fadeImage = MainCanvas.transform.Find("FadeImage").GetComponent<Image>();
|
|
|
|
PopupUiList = new List<PopupUi>(8);
|
|
}
|
|
|
|
private void RegisterPopup(PopupUi popup)
|
|
{
|
|
if (!PopupUiList.Contains(popup))
|
|
{
|
|
PopupUiList.Add(popup);
|
|
}
|
|
}
|
|
|
|
private void UnregisterPopup(PopupUi popup)
|
|
{
|
|
if (PopupUiList.Contains(popup))
|
|
{
|
|
PopupUiList.Remove(popup);
|
|
}
|
|
}
|
|
|
|
public void CloseLastPopup()
|
|
{
|
|
if (PopupUiList.Count <= 0) return;
|
|
|
|
PopupUiList[^1].Close();
|
|
}
|
|
|
|
public void CloseAllPopup()
|
|
{
|
|
var tempList = new List<PopupUi>(PopupUiList);
|
|
|
|
foreach (var popup in tempList)
|
|
{
|
|
popup.Close();
|
|
}
|
|
|
|
PopupUiList.Clear();
|
|
}
|
|
|
|
public void FadeInOut()
|
|
{
|
|
_fadeImage.enabled = true;
|
|
_fadeImage.color = new Color(1, 1, 1, 0);
|
|
_fadeImage.DOFade(1f, _fadeInOutDuration.x).OnComplete(() =>
|
|
{
|
|
_fadeImage.DOFade(0f, _fadeInOutDuration.y).OnComplete(() =>
|
|
{
|
|
_fadeImage.enabled = false;
|
|
});
|
|
});
|
|
}
|
|
|
|
public void RestartCurrentStage()
|
|
{
|
|
MapManager.Instance.InitializeMap();
|
|
CloseAllPopup();
|
|
}
|
|
|
|
public void MoveNextStage()
|
|
{
|
|
DataManager.Instance.CurrentSaveStage++;
|
|
RestartCurrentStage();
|
|
}
|
|
|
|
public void MoveSelectStage(int stage)
|
|
{
|
|
DataManager.Instance.CurrentSaveStage = (SaveStage)stage;
|
|
RestartCurrentStage();
|
|
}
|
|
|
|
public void MoveTitleScene()
|
|
{
|
|
PostProcessingManager.Instance.ToggleRendererFeature(RendererFeatureName.GrayscaleRenderPassFeature, false);
|
|
VisualFeedbackManager.Instance.SetBaseTimeScale(1f);
|
|
SceneManager.LoadScene("00.CombatTitle");
|
|
}
|
|
|
|
public void QuitGame()
|
|
{
|
|
#if UNITY_EDITOR
|
|
UnityEditor.EditorApplication.isPlaying = false;
|
|
#else
|
|
Application.Quit();
|
|
#endif
|
|
}
|
|
}
|
|
} |