몹 생성 로직 수정, pc 인게임 상태 표시 수정

This commit is contained in:
Ino 2025-03-05 15:40:37 +09:00
parent 9cf145f861
commit 2a9396b090
6 changed files with 89 additions and 81 deletions

View File

@ -62,5 +62,7 @@ messageinfo 엄청 느린 버그
- 일꾼 이속, RND_SKILL - 일꾼 이속, RND_SKILL
몬스터 골드, 아이템 드랍 몬스터 골드, 아이템 드랍
상태 이상 ui 표시 상태 이상 ui 표시
- https://www.notion.so/devlucas/c4dc5df0d9d64c95963c6e540acdca7c#e3ef07bc84ff424790bb723835bbce87 - Boss
//- Pet
//- PC

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -22,6 +22,23 @@ public class MobControlMgr : MyCoroutine
if (!DSUtil.CheckNull(m_MonsterAppearData)) if (!DSUtil.CheckNull(m_MonsterAppearData))
{ {
text_lv.text = DSUtil.Format("Lv.{0}", m_MonsterAppearData.n_AppearMonsterLv); text_lv.text = DSUtil.Format("Lv.{0}", m_MonsterAppearData.n_AppearMonsterLv);
var list_make_mobs = Get_Mobs();
for (int i = 0; i < list_make_mobs.Count; i++)
{
var rdnpos = DSUtil.Get_RandomPos_onNavMesh(transform.position, 0f, MobGenRange);
var mobData = list_make_mobs[i];
yield return StartCoroutine(Make_Mob(mobData, i, rdnpos));
}
// 생성한 몬스터를 m_MonsterAppearData.n_MaxMonsterCount 만큼 활성화
for (int i = 0; i < m_MonsterAppearData.n_MaxMonsterCount; i++)
dic_actors[0][i].On_Regen();
}
}
List<MonsterTableData> Get_Mobs()
{
var list_make_mobs = new List<MonsterTableData>(); var list_make_mobs = new List<MonsterTableData>();
switch (m_MonsterAppearData.e_SpawnerType) switch (m_MonsterAppearData.e_SpawnerType)
{ // 생성할 몹 정보 { // 생성할 몹 정보
@ -55,14 +72,12 @@ public class MobControlMgr : MyCoroutine
} }
break; break;
} }
return list_make_mobs;
}
int makemobcount = 0; IEnumerator Make_Mob(MonsterTableData mobData, int i, Vector3 rdnpos)
for (int i = 0; i < list_make_mobs.Count; i++)
{ {
int indexCopy = i; // 현재 i 값을 지역 변수에 저장하여 안전하게 캡처 bool makeComplete = false;
var rdnpos = DSUtil.Get_RandomPos_onNavMesh(transform.position, 0f, MobGenRange);
var mobData = list_make_mobs[indexCopy];
AddrResourceMgr.Ins.LoadObject<GameObject>(mobData.s_MonsterPrefab, handle => AddrResourceMgr.Ins.LoadObject<GameObject>(mobData.s_MonsterPrefab, handle =>
{ {
var mob = DSUtil.Get_Clone<MobActor>(handle.Result, transform); var mob = DSUtil.Get_Clone<MobActor>(handle.Result, transform);
@ -78,29 +93,22 @@ public class MobControlMgr : MyCoroutine
case eSpawnerType.Phase: case eSpawnerType.Phase:
case eSpawnerType.PhaseAllKill: case eSpawnerType.PhaseAllKill:
var list_ids = m_MonsterAppearData.Get_MobIds(); var list_ids = m_MonsterAppearData.Get_MobIds();
int findindex = list_ids.FindIndex(f => f == list_make_mobs[indexCopy].n_MonsterID); int findindex = list_ids.FindIndex(f => f == mobData.n_MonsterID);
if (findindex >= 0 && findindex < dic_actors.Count) // 인덱스가 유효한지 체크 if (findindex >= 0 && findindex < dic_actors.Count) // 인덱스가 유효한지 체크
dic_actors[findindex].Add(mob); dic_actors[findindex].Add(mob);
else else
Debug.LogError($"Invalid findindex: {findindex}, MonsterID: {list_make_mobs[indexCopy].n_MonsterID}"); Debug.LogError($"Invalid findindex: {findindex}, MonsterID: {mobData.n_MonsterID}");
break; break;
} }
mob.Set(true, null, null, m_MonsterAppearData.n_SpawnerID, false); mob.Set(true, null, null, m_MonsterAppearData.n_SpawnerID, false);
mob.Set(mobData, rdnpos, actDie, indexCopy); mob.Set(mobData, rdnpos, actDie, i);
mob.Off(); mob.Off();
mob.MagicID = 0; mob.MagicID = 0;
makeComplete = true;
++makemobcount;
}); });
}
while (makemobcount < list_make_mobs.Count) yield return null; while (!makeComplete) yield return null;
// 생성한 몬스터를 m_MonsterAppearData.n_MaxMonsterCount 만큼 활성화
for (int i = 0; i < m_MonsterAppearData.n_MaxMonsterCount; i++)
dic_actors[0][i].On_Regen();
}
} }
private void actDie(int mobid) private void actDie(int mobid)

View File

@ -1,6 +1,3 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
@ -9,7 +6,7 @@ public class IngameBuffDebuffCard : CardBase
public Image i_icon, i_cooltime; public Image i_icon, i_cooltime;
IngameBuffDebuffData m_Data; IngameBuffDebuffData m_Data;
float f_Time; float f_MaxTime;
public override void Set<T>(T _base) public override void Set<T>(T _base)
{ {
@ -17,13 +14,15 @@ public class IngameBuffDebuffCard : CardBase
m_Data = _base as IngameBuffDebuffData; m_Data = _base as IngameBuffDebuffData;
i_icon.sprite = UIAtlasMgr.Ins.Get_Sprite(m_Data.s_Icon); i_icon.sprite = UIAtlasMgr.Ins.Get_Sprite(m_Data.s_Icon);
i_cooltime.fillAmount = 0f; i_cooltime.fillAmount = 0f;
f_Time = m_Data.f_Time; f_MaxTime = m_Data.f_Time;
} }
private void Update() private void Update()
{ {
f_Time -= Time.deltaTime; m_Data.f_Time -= Time.deltaTime;
i_cooltime.fillAmount = f_Time / m_Data.f_Time; i_cooltime.fillAmount = m_Data.f_Time / f_MaxTime;
if (m_Data.f_Time <= 0f)
gameObject.SetActive(false);
} }
} }

View File

@ -38,7 +38,7 @@ public class MyInfoUI : MonoBehaviourSingletonuScrollViewArrMgr<MyInfoUI>
Set_MainStats(); Set_MainStats();
Set_ScrollView(1, list_buffindex, false); Set_ScrollView(1, list_buffindex, false);
Set_ScrollView(2, list_buffDebuffDatas, false); CardBase_AllOff(2);
} }
public void Set_HP(double curHP, double maxHP) public void Set_HP(double curHP, double maxHP)
@ -75,8 +75,7 @@ public class MyInfoUI : MonoBehaviourSingletonuScrollViewArrMgr<MyInfoUI>
} }
} }
if (!add) if (!add) list_buffDebuffDatas.Add(new IngameBuffDebuffData { s_Icon = icon, f_Time = time });
list_buffDebuffDatas.Add(new IngameBuffDebuffData { s_Icon = icon, f_Time = time });
Set_ScrollView(2, list_buffDebuffDatas, false); Set_ScrollView(2, list_buffDebuffDatas, false);
} }