/// <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.GetAmount();
            int     emptySlot = CheckEmpty();
            OilType type      = cargo.GetCargoType();

            if (value != 0 && emptySlot > 0 && type == OilType.CrudeOil)
            {
                FillOil(value);
            }
            else if (type != OilType.CrudeOil)
            {
                MessageBroker.Default.Publish(new NotificationMessage()
                {
                    Warning = NotificationType.WrongType
                });
            }
            else if (value == 0 && type == OilType.CrudeOil)
            {
                MessageBroker.Default.Publish(new NotificationMessage()
                {
                    Warning = NotificationType.CargoEmpty
                });
            }
            else if (value != 0 && emptySlot == 0 && type == OilType.CrudeOil)
            {
                MessageBroker.Default.Publish(new NotificationMessage()
                {
                    Warning = NotificationType.RefineryFull
                });
            }
        }
Пример #3
0
 /// <summary>
 /// Is called when cargo received
 /// </summary>
 /// <param name="cargo"></param>
 private void OnCargoReceived(CargoController cargo)
 {
     CheckOrder(cargo.GetCargoType(), cargo.GetAmount());
 }