/// <summary> /// Is called when amount of cargo received /// </summary> /// <param name="cargo"></param> private void OnCargoReceived(CargoController cargo) { OilType type = cargo.GetCargoType(); if (type == OilType.CrudeOil) { //2 things happen, store and extract if (storing) { int value = cargo.GetAmount(); //fill if (value != 0) { FillOil(value); } storing = false; } else if (!storing) { int value = cargo.CheckEmpty(); //extract if (value != 0) { ExtractOil(value); } storing = true; } } }
/// <summary> /// Is called when amount of cargo received /// </summary> /// <param name="cargo"></param> private void OnCargoReceived(CargoController cargo) { int value = cargo.CheckEmpty(); OilType type = cargo.GetCargoType(); if (value != 0 && type == OilType.ProcessedOil) { ExtractOil(value); } else if (type != OilType.ProcessedOil) { MessageBroker.Default.Publish(new NotificationMessage() { Warning = NotificationType.WrongType }); } else if (value == 0 && type == OilType.ProcessedOil) { MessageBroker.Default.Publish(new NotificationMessage() { Warning = NotificationType.CargoFull }); } }