private void ConsumeRessources(ReceiverComponent receiverComponent, FoodConsumer foodConsumer, int nmbDwarfIn) { if (!receiverComponent) { return; } if (foodConsumer.timeSinceLastConsumption >= foodConsumer.minuteBeforConsuming * FramesPerSecond * secondPerMinute) { receiverComponent.amount -= nmbDwarfIn; foodConsumer.timeSinceLastConsumption = 0; } else { foodConsumer.timeSinceLastConsumption++; } }
private void addNewDwellingsSlotsAndFoodInventory(ReceiverComponent recieverComponent, DwarfsSlots dwarfsSlots, FoodConsumer foodConsumer) { ReceiverComponent[] tmpFoodReceiever = new ReceiverComponent[recieverFoods.Length + 1]; DwarfsSlots[] tmpDwarfsSlots = new DwarfsSlots[dwellingSlots.Length + 1]; FoodConsumer[] tmpFoodConsumers = new FoodConsumer[foodConsumers.Length + 1]; for (int i = 0; i < recieverFoods.Length; i++) { tmpFoodReceiever[i] = recieverFoods[i]; tmpDwarfsSlots[i] = dwellingSlots[i]; tmpFoodConsumers[i] = foodConsumers[i]; } tmpFoodReceiever[tmpFoodReceiever.Length - 1] = recieverComponent; tmpDwarfsSlots[tmpDwarfsSlots.Length - 1] = dwarfsSlots; tmpFoodConsumers[tmpFoodConsumers.Length - 1] = foodConsumer; recieverFoods = tmpFoodReceiever; dwellingSlots = tmpDwarfsSlots; foodConsumers = tmpFoodConsumers; }