Browse Source

battleentities 개선

sound
ldh 1 year ago
parent
commit
c39036004c
  1. 77
      Assets/_2_0Script/Mgr/BattleMgr.cs

77
Assets/_2_0Script/Mgr/BattleMgr.cs

@ -1499,6 +1499,8 @@ public class BattleMgr : Singleton<BattleMgr>
hpBarEnemies[i].HideHpBar(); hpBarEnemies[i].HideHpBar();
} }
} }
UnregistBattleEntities(ivMonsters);
iMonsterCount = 0; iMonsterCount = 0;
} }
@ -1943,34 +1945,38 @@ public class BattleMgr : Singleton<BattleMgr>
indexlist.RemoveAt(irand); indexlist.RemoveAt(irand);
v3pos.z = v3pos.y * 0.1f; v3pos.z = v3pos.y * 0.1f;
var monster = ivMonsters[index];
if (iWave == iTotalWave) if (iWave == iTotalWave)
{ {
if(ivMonsters[index].GetCreatureClass() == eCreatureClass.elite)
if(monster.GetCreatureClass() == eCreatureClass.elite)
{ {
ivMonsters[index].ResetDebuff();
ivMonsters[index].SetStatus(biatk, fhp, dConst.RateMaxFloat, 0, dConst.RateMaxFloat * 0.1f * fspeed, dConst.RateMax, frange, igroup: igroup);
hpBarEnemies[i].ReSetoffsetY(ivMonsters[index].GetMonType());
ivMonsters[index].Summon(v3pos, trfChar.position.x > v3pos.x);
monster.ResetDebuff();
monster.SetStatus(biatk, fhp, dConst.RateMaxFloat, 0, dConst.RateMaxFloat * 0.1f * fspeed, dConst.RateMax, frange, igroup: igroup);
hpBarEnemies[i].ReSetoffsetY(monster.GetMonType());
monster.Summon(v3pos, trfChar.position.x > v3pos.x);
iMonsterCount++; iMonsterCount++;
} }
if (ivMonsters[index].GetCreatureClass() == eCreatureClass.boss)
if (monster.GetCreatureClass() == eCreatureClass.boss)
{ {
ivMonsters[index].ResetDebuff();
ivMonsters[index].SetStatus(biatk, fhp, dConst.RateMaxFloat, 0, dConst.RateMaxFloat * 0.1f * fspeed, dConst.RateMax, frange, igroup: igroup);
hpBarEnemies[i].ReSetoffsetY(ivMonsters[index].GetMonType());
ivMonsters[index].Summon(v3pos, trfChar.position.x > v3pos.x);
monster.ResetDebuff();
monster.SetStatus(biatk, fhp, dConst.RateMaxFloat, 0, dConst.RateMaxFloat * 0.1f * fspeed, dConst.RateMax, frange, igroup: igroup);
hpBarEnemies[i].ReSetoffsetY(monster.GetMonType());
monster.Summon(v3pos, trfChar.position.x > v3pos.x);
iMonsterCount++; iMonsterCount++;
} }
} }
else else
{ {
ivMonsters[index].ResetDebuff();
ivMonsters[index].SetStatus(biatk, fhp, dConst.RateMaxFloat, 0, dConst.RateMaxFloat * 0.1f * fspeed, dConst.RateMax, frange, igroup: igroup);
hpBarEnemies[i].ReSetoffsetY(ivMonsters[index].GetMonType());
ivMonsters[index].Summon(v3pos, trfChar.position.x > v3pos.x);
monster.ResetDebuff();
monster.SetStatus(biatk, fhp, dConst.RateMaxFloat, 0, dConst.RateMaxFloat * 0.1f * fspeed, dConst.RateMax, frange, igroup: igroup);
hpBarEnemies[i].ReSetoffsetY(monster.GetMonType());
monster.Summon(v3pos, trfChar.position.x > v3pos.x);
iMonsterCount++; iMonsterCount++;
} }
RegistBattleEntities(monster);
if (indexlist.Count == 0) if (indexlist.Count == 0)
break; break;
} }
@ -2287,17 +2293,21 @@ public class BattleMgr : Singleton<BattleMgr>
v3pos.y += Random.Range(-0.7f, 0.7f); v3pos.y += Random.Range(-0.7f, 0.7f);
v3pos.z = v3pos.y * 2f; v3pos.z = v3pos.y * 2f;
ivMonsters[index].ResetDebuff();
ivMonsters[index].SetStatus(biatk, fhp, dConst.RateMaxFloat, 0, dConst.RateMaxFloat * 0.1f * fspeed, dConst.RateMax, frange, igroup: igroup);
var monster = ivMonsters[index];
monster.ResetDebuff();
monster.SetStatus(biatk, fhp, dConst.RateMaxFloat, 0, dConst.RateMaxFloat * 0.1f * fspeed, dConst.RateMax, frange, igroup: igroup);
if (CurrentBattleType == BattleType.AwakenDungeon) if (CurrentBattleType == BattleType.AwakenDungeon)
{ {
if(index == GetAvailDgMonsterIndex(CreatureBase.eDgCreatureClass.DgN3)) if(index == GetAvailDgMonsterIndex(CreatureBase.eDgCreatureClass.DgN3))
{ {
ivMonsters[index].SetStatus(biatk, fhp, dConst.RateMaxFloat, 0, dConst.RateMaxFloat * 0.1f * fspeed, dConst.RateMax, frange, false, false, igroup: igroup);
monster.SetStatus(biatk, fhp, dConst.RateMaxFloat, 0, dConst.RateMaxFloat * 0.1f * fspeed, dConst.RateMax, frange, false, false, igroup: igroup);
} }
} }
hpBarEnemies[index].ReSetoffsetY(ivMonsters[index].GetMonType());
ivMonsters[index].Summon(v3pos, trfChar.position.x > v3pos.x);
hpBarEnemies[index].ReSetoffsetY(monster.GetMonType());
monster.Summon(v3pos, trfChar.position.x > v3pos.x);
RegistBattleEntities(monster);
iMonsterCount++; iMonsterCount++;
if (indexlist.Count == 0) if (indexlist.Count == 0)
@ -2481,6 +2491,7 @@ public class BattleMgr : Singleton<BattleMgr>
public void DieEnemy(eCreatureClass cls, int index) public void DieEnemy(eCreatureClass cls, int index)
{ {
iMonsterCount--; iMonsterCount--;
UnregistBattleEntities(ivMonsters[index]);
if (CurrentBattleType == BattleType.Pvp) if (CurrentBattleType == BattleType.Pvp)
{ {
@ -3208,16 +3219,25 @@ public class BattleMgr : Singleton<BattleMgr>
#endregion Heal #endregion Heal
#region BattleEntities #region BattleEntities
private HashSet<IBattleEntity> addRegisterSet = new();
private HashSet<IBattleEntity> removeRegisterSet = new();
public void RegistBattleEntities(params IBattleEntity[] entities) public void RegistBattleEntities(params IBattleEntity[] entities)
{ {
for (int i = 0; i < entities.Length; i++)
battleEntities.Add(entities[i]);
for(int i = 0; i < entities.Length; i++)
{
removeRegisterSet.Remove(entities[i]);
addRegisterSet.Add(entities[i]);
}
} }
public void UnregistBattleEntities(params IBattleEntity[] entities) public void UnregistBattleEntities(params IBattleEntity[] entities)
{ {
for (int i = 0; i < entities.Length; i++)
battleEntities.Remove(entities[i]);
for(int i = 0; i < entities.Length; i++)
{
addRegisterSet.Remove(entities[i]);
removeRegisterSet.Add(entities[i]);
}
} }
/// <summary> /// <summary>
@ -3228,10 +3248,17 @@ public class BattleMgr : Singleton<BattleMgr>
if (ivChar.IsBattleAvail() && !func(ivChar)) return; if (ivChar.IsBattleAvail() && !func(ivChar)) return;
if (CurrentBattleType == BattleType.Pvp && ivCharEnemy.IsBattleAvail() && !func(ivCharEnemy)) return; if (CurrentBattleType == BattleType.Pvp && ivCharEnemy.IsBattleAvail() && !func(ivCharEnemy)) return;
for (int i = 0; i < ivMonsters.Length; i++)
foreach (var entity in addRegisterSet)
{
battleEntities.Add(entity);
}
addRegisterSet.Clear();
foreach (var entity in removeRegisterSet)
{ {
if (ivMonsters[i].IsBattleAvail() && !func(ivMonsters[i])) return;
battleEntities.Remove(entity);
} }
removeRegisterSet.Clear();
foreach (var bEntity in battleEntities) foreach (var bEntity in battleEntities)
{ {

Loading…
Cancel
Save