/// <summary> /// Check for empty slot /// </summary> /// <returns></returns> private int CheckEmpty() { int result = 0; for (int i = 0; i < amount; i++) { if (refineryModel.IsEmpty(i)) { result++; } } return(result); }
/// <summary> /// extract the given amount of oil /// </summary> private void ExtractOil(int cargoSlot) { bool taken = false; int availableOil = 0; int slot = cargoSlot; //remove on building for (int i = 0; i < capacity; i++) { if (refineryOutModel.IsEmpty(i) == false) { Empty(i); taken = true; availableOil++; slot--; if (slot == 0) { break; } } } //send to cargo if (availableOil != 0) { SendOil(availableOil); } //something is taken if (taken) { if (GetEmptySlot() == capacity) { MessageBroker.Default.Publish(new RefineryStateMessage() { Open = true }); refineryOutView.TurnOff(); } } }