public static void ValidatePlayerType(this GameDef gameDef, PlayerTypeDefId playerTypeDefId, string hint) { if (!gameDef.PlayerTypes.Any(x => x.Id.Equals(playerTypeDefId))) { throw new InvalidGameDefException($"Player type '{playerTypeDefId}' not found. Check '{hint}'!"); } }
public static IEnumerable <UnitDef> GetUnitsByPlayerType(this GameDef gameDef, PlayerTypeDefId playerTypeId) { return(gameDef.Units.Where(x => x.PlayerTypeRestriction.Equals(playerTypeId))); }