using System.Collections.Generic; using CoreGame.Render; using Entitas; public partial class Contexts { public static CombatContext Combat => _sharedInstance.combat; // public static CombatEntity cameraEnt; public static bool IsValid => _sharedInstance != null; public static readonly List s_CacheEntities = new List(50); public const string FactionCommonBeQueryParam = "FactionCommonBeQueryParam"; [Entitas.CodeGeneration.Attributes.PostConstructor] public void InitializeEntityIndices2() { combat.AddEntityIndex(new Entitas.EntityIndex( FactionCommonBeQueryParam, combat.GetGroup(CombatMatcher.Faction), (e, c) => ((FactionComponent)c).commonBeQueryParam, new QueryParamEqualityComparer())); } } public static class ContextsExt { public static System.Collections.Generic.HashSet GetEntitiesWithFactionCommonBeQueryParam(this CombatContext context, QueryParam commonBeQueryParam) { return ((Entitas.EntityIndex)context.GetEntityIndex(Contexts.FactionCommonBeQueryParam)).GetEntities(commonBeQueryParam); } }