Пример #1
0
 public void MoveToHome()
 {
     while (!NextCoordinates.IsLocatedIn(BaseCoordinates))
     {
         MoveTo(BaseCoordinates);
     }
 }
Пример #2
0
 public void MoveTo(Coordinates coordinates)
 {
     Thread.Sleep(100);
     if (!NextCoordinates.IsLocatedIn(coordinates))
     {
         NextCoordinates.ShiftTo(coordinates);
     }
 }
Пример #3
0
 public void Repair()
 {
     while (!NextCoordinates.IsLocatedIn(Warehouse.Coordinates))
     {
         MoveTo(Warehouse.Coordinates);
     }
     Thread.Sleep(1000);
     Warehouse.NeedMechanic = false;
     Warehouse.Workload     = 0;
     Warehouse.ImageId      = 1;
     MoveToHome();
 }
Пример #4
0
 public void Run()
 {
     while (true)
     {
         if (Warehouses.Count == 0)
         {
             MoveTo(BaseCoordinates);
         }
         else
         {
             while (!NextCoordinates.IsLocatedIn(Warehouses[0].Coordinates))
             {
                 MoveTo(Warehouses[0].Coordinates);
             }
             Unload(Warehouses[0]);
         }
     }
 }
Пример #5
0
 public void Run()
 {
     while (true)
     {
         if (Warehouses.Count == 0)
         {
             MoveTo(BaseCoordinates);
         }
         else
         {
             Warehouse warehouse = Next();
             while (!NextCoordinates.IsLocatedIn(warehouse.Coordinates))
             {
                 MoveTo(warehouse.Coordinates);
             }
             Unload(warehouse);
         }
     }
 }
Пример #6
0
        public Warehouse Next()
        {
            Warehouse warehouse = null;

            foreach (Warehouse current in Warehouses)
            {
                if (warehouse == null)
                {
                    warehouse = current;
                }
                else
                {
                    if (NextCoordinates.CalculateDistanceTo(warehouse.Coordinates) > NextCoordinates.CalculateDistanceTo(current.Coordinates))
                    {
                        warehouse = current;
                    }
                }
            }
            return(warehouse);
        }
Пример #7
0
 public bool InBaseCoordinates()
 {
     return(NextCoordinates.IsLocatedIn(BaseCoordinates));
 }