public static IEnumerable <GameUnit> GenerateGameUnits(this AgentFactory factory, IEnumerable <Unit> units) { foreach (var unit in units) { var agent = factory.CreateFor(unit); yield return(new GameUnit(unit, agent)); } }