using CodeStage.AntiCheat.ObscuredTypes; using System; using System.Collections; using UnityEngine; public class DungeonInfo : MonoBehaviourSingletonTemplate { public Action act_Time; public Action act_MobDieCount; private ObscuredFloat _Time; public float m_Time { get { return _Time; } set { _Time = value; _Time.RandomizeCryptoKey(); } } private ObscuredInt _MaxDieMobCount; public int m_MaxDieMobCount { get { return _MaxDieMobCount; } set { _MaxDieMobCount = value; _MaxDieMobCount.RandomizeCryptoKey(); } } private ObscuredInt _DieCount; public int m_DieCount { get { return _DieCount; } set { _DieCount = value; _DieCount.RandomizeCryptoKey(); } } private ObscuredInt _MazeClear; public int m_MazeClear { get { return _MazeClear; } set { _MazeClear = value; _MazeClear.RandomizeCryptoKey(); } } eDungeon m_Dungeon; public void Stop_Dungeon(bool? win) { act_Time = null; StopAllCoroutines(); Time.timeScale = 0f; Ingame_DungeonResult.Ins.Show_Result(win); } IEnumerator Co_Update_Time() { while (m_Time > 0f) { yield return null; m_Time -= Time.deltaTime; act_Time?.Invoke(m_Time); } // 시간 오버 Stop_Dungeon(false); } void Set_MobDie(int mobid) { ++m_DieCount; act_MobDieCount?.Invoke(m_DieCount); if (m_DieCount == m_MaxDieMobCount) { switch (m_Dungeon) { case eDungeon.d1_Mimic: Stop_Dungeon(true); break; case eDungeon.d2_Maze: ++m_MazeClear; StopAllCoroutines(); LoadMapMgr.Ins.Set_MazeNextPortal(MyValue.MyChoiceMapData.n_PortalIndex, true); //MyValue.MyChoiceMapData.Set_MazeMapIndex(); // 포탈 입장 시 break; case eDungeon.d3_Nightmare: break; case eDungeon.d4_Wave: break; } } } void Make_Mob(eSubRol subrol, MonsterTableData mobData, DungeonMapConfigTableData dgData, float minDist, float MaxDist) { AddrResourceMgr.Ins.LoadObject(mobData.s_MonsterPrefab, handle => { var mob = DSUtil.Get_Clone(handle.Result); ActorInfo.Ins.Add_Actor(mob, eRole.Mob, dgData.n_SpawnID, mobData.s_MonsterPrefab); mob.Set(true, null, null, dgData.n_SpawnID, false); var rdnpos = DSUtil.Get_RandomPos_onNavMesh(MyValue.MyPC.Get_position(), minDist, MaxDist); mob.Set(mobData, rdnpos, Set_MobDie, 0); mob.m_SubRole = subrol; }); } public void Start_Dungeon(bool first) { m_DieCount = 0; if (first) m_MazeClear = 0; m_Dungeon = MyValue.MyChoiceMapData.Get_MapData().e_Dungeon; switch (m_Dungeon) { case eDungeon.d1_Mimic: StartCoroutine(Co_Update_Mimic()); break; case eDungeon.d2_Maze: StartCoroutine(Co_Update_Maze()); break; case eDungeon.d3_Nightmare: break; case eDungeon.d4_Wave: break; } } IEnumerator Co_Update_Mimic() { yield return new WaitForSeconds(1f); StartCoroutine(Co_Update_Time()); float min = 5f, max = 15f; var mapdata = MyValue.MyChoiceMapData.Get_MapData(); var dungeonData = MyValue.MyChoiceMapData.Get_DungeonMapData_orNull(); var mimicData = table_monsterlist.Ins.Get_Data_orNull(dungeonData.n_MobID); var mobCount = dungeonData.n_MobCount; while (mobCount > 0) { --mobCount; Make_Mob(eSubRol.Mimic, mimicData, dungeonData, min, max); yield return new WaitForSeconds(dungeonData.f_MakeGap); } } IEnumerator Co_Update_Maze() { float min = 10f, max = 20f; var dgData = MyValue.MyChoiceMapData.Get_DungeonMapData_orNull(); for (int i = 0; i < dgData.n_MobCount; i++) Make_Mob(eSubRol.None, table_monsterlist.Ins.Get_RandomData(eSubRol.None), dgData, min, max); if (m_MazeClear >= 5) { m_MazeClear = 0; Make_Mob(eSubRol.Boss, table_monsterlist.Ins.Get_RandomData(eSubRol.Boss), dgData, min, max); } yield return new WaitForSeconds(1f); StartCoroutine(Co_Update_Time()); } }