using System; using System.Collections.Generic; using EcsRx.Entities; namespace EcsRx.Groups { public class GroupWithPredicate : Group, IHasPredicate { public Predicate EntityPredicate { get; } public GroupWithPredicate(Predicate entityPredicate, params Type[] requiredComponents): this(entityPredicate, requiredComponents, new Type[0]){} public GroupWithPredicate(Predicate entityPredicate, IEnumerable requiredComponents, IEnumerable excludedComponents) : base(requiredComponents, excludedComponents) { EntityPredicate = entityPredicate; } public bool CanProcessEntity (IEntity entity) { return EntityPredicate == null || EntityPredicate(entity); } } }