Project_WL/Assets/Script/UI/Ingame/Dungeon/Ingame_Dungeon.cs

44 lines
2.0 KiB
C#

using TMPro;
using UnityEngine;
public class Ingame_Dungeon : MonoBehaviour
{
public Ingame_DungeonBase[] ingame_Dungeons; // 0 미믹, 1 미궁, 2 악몽, 3 웨이브
public TextMeshProUGUI[] texts_base; // 0 던전 정보, 1 남은 시간
public void Set(float time, int maxMobCount)
{
gameObject.SetActive(true);
Set_DungeonInfo();
Set_TextTime(time);
for (int i = 0; i < ingame_Dungeons.Length; i++)
ingame_Dungeons[i].gameObject.SetActive(false);
ingame_Dungeons[MyValue.MyChoiceMapData.Get_DungeonIndex()].Set_DungeonInfo(maxMobCount);
DungeonInfo.Ins.Set_Time(MyValue.MyChoiceMapData.n_DungeonLv, time);
DungeonInfo.Ins.act_Time = Set_TextTime;
}
void Set_DungeonInfo()
{
var mapData = table_battlemapconfig.Ins.Get_Data(MyValue.MyChoiceMapData.n_MapID);
switch (MyValue.MyChoiceMapData.Get_DungeonMapData_orNull().e_DungeonType)
{
case eDungeon.d1_Mimic:
texts_base[0].text = $"{mapData.Get_Name()} Lv.{MyValue.MyChoiceMapData.n_DungeonLv}";
break;
case eDungeon.d2_Maze:
texts_base[0].text = $"{mapData.Get_Name()} F{MyValue.MyChoiceMapData.n_DungeonLv}";
break;
case eDungeon.d3_Nightmare:
texts_base[0].text = $"{mapData.Get_Name()} {MyValue.MyChoiceMapData.n_Difficult}";
DungeonInfo.Ins.Set_Nightmare(ingame_Dungeons[MyValue.MyChoiceMapData.Get_DungeonIndex()].Set_TotalDmg);
break;
case eDungeon.d4_Wave:
texts_base[0].text = $"{mapData.Get_Name()} {MyValue.MyChoiceMapData.n_Difficult}";
var dgindex = MyValue.MyChoiceMapData.Get_DungeonIndex();
DungeonInfo.Ins.Set_Wave(ingame_Dungeons[dgindex].Set_TotalScore, ingame_Dungeons[dgindex].Set_TotalLife);
break;
}
}
void Set_TextTime(float time) { texts_base[1].text = Mathf.Max(0f, time).ToString("F2"); }
}