using System; using System.Collections.Generic; namespace Gallium { public static class ForEntityExtensions { /// /// Selects an entity from the given list, filtering on entities with /// the given components. If the entity doesn't match, it is passed as it. /// /// The entities to parse. /// /// The transformation function for the entity /// and selected components. If this returns null, then the entity will be filtered /// out. /// /// The type of the first component. /// An enumeration of transformed entities. public static IEnumerable ForEntity( this IEnumerable entities, Func selectWithComponents) { return entities.SelectEntity(selectWithComponents, a => a); } /// /// Selects an entity from the given list, filtering on entities with /// the given components. If the entity doesn't match, it is passed as it. /// /// The entities to parse. /// /// The transformation function for the entity /// and selected components. If this returns null, then the entity will be filtered /// out. /// /// The type of the first component. /// The type of the second component. /// An enumeration of transformed entities. public static IEnumerable ForEntity( this IEnumerable entities, Func selectWithComponents) { return entities.SelectEntity(selectWithComponents, a => a); } /// /// Selects an entity from the given list, filtering on entities with /// the given components. If the entity doesn't match, it is passed as it. /// /// The entities to parse. /// /// The transformation function for the entity /// and selected components. If this returns null, then the entity will be filtered /// out. /// /// The type of the first component. /// The type of the second component. /// The type of the third component. /// An enumeration of transformed entities. public static IEnumerable ForEntity( this IEnumerable entities, Func selectWithComponents) { return entities.SelectEntity(selectWithComponents, a => a); } /// /// Selects an entity from the given list, filtering on entities with /// the given components. If the entity doesn't match, it is passed as it. /// /// The entities to parse. /// /// The transformation function for the entity /// and selected components. If this returns null, then the entity will be filtered /// out. /// /// The type of the first component. /// The type of the second component. /// The type of the third component. /// The type of the third component. /// An enumeration of transformed entities. public static IEnumerable ForEntity( this IEnumerable entities, Func selectWithComponents) { return entities.SelectEntity( selectWithComponents, a => a); } } }