using System; using System.Collections.Generic; namespace ET { public class FamilyBossDestroySystem : DestroySystem { public override void Destroy(FamilyBoss self) { self.Destroy(); } } public static class FamilyBossSystem { public static int GetBossHp(this FamilyBoss self, int bossId) { if (!self.bossHpDic.TryGetValue(bossId, out int hp)) { Log.Error($"bossHpDic has not the key = {bossId}"); hp = 0; } return hp; } public static void SetBossHp(this FamilyBoss self, int bossId, int hp) { if (hp <= 0) { hp = 0; if (self.lockedMaxId == bossId) self.lockedMaxId++; } self.bossHpDic[bossId] = hp; FamilyBossComponent.instance.Save(self).Coroutine(); } public static LinkedList GetRankList(this FamilyBoss self, int bossId) { self.rankDic.TryGetValue(bossId, out LinkedList list); return list; } public static void InsertDamageInfo(this FamilyBoss self, int bossId, BossDamageMap bossDamageMap) { LinkedList list = self.GetRankList(bossId); LinkedListHelper.InsertToLinkedListAndSort(list, bossDamageMap, (p1, p2) => p1.TotalDamage > p2.TotalDamage); FamilyBossComponent.instance.Save(self).Coroutine(); } public static void Destroy(this FamilyBoss self) { self.bossHpDic.Clear(); foreach (KeyValuePair> item in self.rankDic) { item.Value.Clear(); } } } }