using System;
using System.Collections.Generic;
namespace MfGames.Gallium;
///
/// Extension methods for selecting components from a list.
///
public static class SelectComponentExtensions
{
///
/// Retrieves a component from an entity and return it. If the entity does not have
/// the component, it will be
/// filtered out.
///
/// The entities to process.
/// The component type being searched.
/// A sequence of T1.
public static IEnumerable SelectComponent(this IEnumerable entities)
{
foreach (Entity entity in entities)
{
if (entity.TryGet(out T1 v1))
{
yield return v1;
}
}
}
///
/// Retrieves a component from an entity and return it. If the entity does not have
/// the component, it will be filtered out.
///
/// The entities to process.
/// The component type being searched.
/// A sequence of T1.
public static IEnumerable