using System; using System.Collections.Generic; using System.Text; namespace ET { public static class TierSystem { private const int Max_Unit_Count_Per_Tier = 50; public static bool CanAdd(this Tier self) => self.unitDic.Count < Max_Unit_Count_Per_Tier; public static void Add(this Tier self,Unit unit) { self. unitDic[unit.Id] = unit; } public static void Remove(this Tier self,long id) { self. unitDic.Remove(id); } public static Unit Get(this Tier self,long id) { self. unitDic.TryGetValue(id, out Unit unit); return unit; } public static IEnumerable GetAll(this Tier self) { return self.unitDic.Values; } public static void Clear(this Tier self) { self. unitDic.Clear(); } } }