You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
1.2 KiB

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<CombatEntity> s_CacheEntities = new List<CombatEntity>(50);
public const string FactionCommonBeQueryParam = "FactionCommonBeQueryParam";
[Entitas.CodeGeneration.Attributes.PostConstructor]
public void InitializeEntityIndices2() {
combat.AddEntityIndex(new Entitas.EntityIndex<CombatEntity, QueryParam>(
FactionCommonBeQueryParam,
combat.GetGroup(CombatMatcher.Faction),
(e, c) => ((FactionComponent)c).commonBeQueryParam,
new QueryParamEqualityComparer()));
}
}
public static class ContextsExt {
public static System.Collections.Generic.HashSet<CombatEntity> GetEntitiesWithFactionCommonBeQueryParam(this CombatContext context, QueryParam commonBeQueryParam) {
return ((Entitas.EntityIndex<CombatEntity, QueryParam>)context.GetEntityIndex(Contexts.FactionCommonBeQueryParam)).GetEntities(commonBeQueryParam);
}
}