Example #1
0
        public IStateSnippet GetState()
        {
            var generic = Items.Where(x => !(x is FoodItemBase) && !(x is WaterVesselItemBase)).ToList();
            var food    = Items.Where(x => x is FoodItemBase).ToList();
            var water   = Items.Where(x => x is WaterVesselItemBase).ToList();

            var state = new InventoryControllerStateSnippet
            {
                RoughWeight = this.RoughWeight,

                GenericInventoryItems = generic.ConvertAll(x => (InventoryItemSnippet)(x as InventoryItemBase).GetState()),
                FoodInventoryItems    = food.ConvertAll(x => (InventoryFoodItemSnippet)(x as FoodItemBase).GetState()),
                WaterInventoryItems   = water.ConvertAll(x => (InventoryWaterVesselItemSnippet)(x as WaterVesselItemBase).GetState())
            };

            return(state);
        }