Exemplo n.º 1
0
 public static T As <T>(this Need_FoodGroup foodGroupNeed) where T : Need_FoodGroup
 {
     if (foodGroupNeed is T foodGroup)
     {
         return(foodGroup);
     }
     return(null);
 }
Exemplo n.º 2
0
 public static SpecialThingFilterDef GetFilter(this Need_FoodGroup foodGroupNeed)
 {
     if (foodGroupNeed is Need_Vegetables)
     {
         return(SpecialThingFilterDef.Named("AllowVegetables"));
     }
     if (foodGroupNeed is Need_Fruit)
     {
         return(SpecialThingFilterDef.Named("AllowFruit"));
     }
     if (foodGroupNeed is Need_Grain)
     {
         return(SpecialThingFilterDef.Named("AllowGrain"));
     }
     if (foodGroupNeed is Need_Protein)
     {
         return(SpecialThingFilterDef.Named("AllowProtein"));
     }
     if (foodGroupNeed is Need_Dairy)
     {
         return(SpecialThingFilterDef.Named("AllowDairy"));
     }
     throw new NotImplementedException();
 }