static void Main(string[] args) { List <FoodAndDrink> foodsAndDrinks = DataGameObjects.IntializeFoodAndDrink(); List <Weapon> weapons = DataGameObjects.InitializeWeapons(); DisplayWeapons(weapons); DisplayFoodAndDrink(foodsAndDrinks); UseWeapons(weapons); UseFoodAndDrink(foodsAndDrinks); }
static void Main(string[] args) { List <GameObject> gameObjects = DataGameObjects.IntializeGameObjects(); // // use LINQ lambda to generate filtered lists // List <GameObject> gameObjectFoodAndDrinks = gameObjects.Where(go => go is FoodAndDrink).ToList(); List <GameObject> gameObjectWeapons = gameObjects.Where(go => go is Weapon).ToList(); DisplayGameObjects(gameObjectFoodAndDrinks); DisplayGameObjects(gameObjectWeapons); UseGameObject(gameObjectFoodAndDrinks); UseGameObject(gameObjectWeapons); }