private int FindFreeCourier(CourierCollection collection) { for (int i = 0; i < collection.Length; i++) { if (collection[i].IsFree) { //collection[i].IsFree = false; return(i); } } return(-1); }
public override void MakeDelivery(CourierCollection collection) { int index = FindFreeCourier(collection); if (index == -1) { Console.WriteLine("Все курьеры заняты, попробуйте сделать заказ позже"); } else { collection[index].IsFree = false; } }
static void Main(string[] args) { var array = new Courier[] { new Courier { IsFree = true }, new Courier { IsFree = true }, new Courier { IsFree = true }, }; CourierCollection collection = new CourierCollection(array); var order = new Order <ShopDelivery>(); order.Delivery.MakeDelivery(); // // // }
public override void TakeItem(int index, CourierCollection collection) { collection[index].IsFree = true; }
public abstract void TakeItem(int index, CourierCollection collection = null);
public abstract void MakeDelivery(CourierCollection collection = null);
public override void TakeItem(int index, CourierCollection collection = null) { PickPoint.ItemCycleOnPickPoint[index] = 0; }
public override void MakeDelivery(CourierCollection collection = null) { }
public override void MakeDelivery(CourierCollection collection = null) { FindFreePlace(); }