107 lines
3.3 KiB
C#
107 lines
3.3 KiB
C#
using CodeStage.AntiCheat.ObscuredTypes;
|
|
using System;
|
|
using System.Collections;
|
|
using UnityEngine;
|
|
using WebSocketSharp;
|
|
|
|
public class DungeonInfo : MonoBehaviourSingletonTemplate<DungeonInfo>
|
|
{
|
|
public ObscuredFloat m_Time;
|
|
public ObscuredInt m_MaxDieMobCount;
|
|
public Action<float> act_Time;
|
|
public Action<int> act_MobDieCount;
|
|
|
|
ObscuredInt m_DieCount;
|
|
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;
|
|
m_Time.RandomizeCryptoKey();
|
|
act_Time?.Invoke(m_Time);
|
|
}
|
|
|
|
// 시간 오버
|
|
Stop_Dungeon(false);
|
|
}
|
|
void Set_MobDie(int mobid)
|
|
{
|
|
++m_DieCount;
|
|
m_DieCount.RandomizeCryptoKey();
|
|
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:
|
|
// 다음 층으로
|
|
break;
|
|
case eDungeon.d3_Nightmare:
|
|
break;
|
|
case eDungeon.d4_Wave:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void Start_Dungeon()
|
|
{
|
|
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()
|
|
{
|
|
m_DieCount = 0;
|
|
m_DieCount.RandomizeCryptoKey();
|
|
yield return new WaitForSeconds(1f);
|
|
StartCoroutine(Co_Update_Time());
|
|
|
|
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;
|
|
AddrResourceMgr.Ins.LoadObject<GameObject>(mimicData.s_MonsterPrefab, handle =>
|
|
{
|
|
var mob = DSUtil.Get_Clone<MobActor>(handle.Result);
|
|
ActorInfo.Ins.Add_Actor(mob, eRole.Mob, dungeonData.n_SpawnID, mimicData.s_MonsterPrefab);
|
|
mob.Set(true, null, null, dungeonData.n_SpawnID, false);
|
|
var rdnpos = DSUtil.Get_RandomPos_onNavMesh(MyValue.MyPC.Get_position(), 0f, 10f);
|
|
mob.Set(mimicData, rdnpos, Set_MobDie, 0);
|
|
mob.m_SubRole = eSubRol.Mimic;
|
|
});
|
|
yield return new WaitForSeconds(dungeonData.f_MakeGap);
|
|
}
|
|
}
|
|
|
|
IEnumerator Co_Update_Maze()
|
|
{
|
|
var dgData = MyValue.MyChoiceMapData.Get_DungeonMapData_orNull();
|
|
for (int i = 0; i < dgData.n_MobCount; i++)
|
|
{
|
|
//var mobid = table_monsterlist.Ins.Get_Data_orNull
|
|
}
|
|
yield return null;
|
|
}
|
|
} |