public void MoveToHome() { while (!NextCoordinates.IsLocatedIn(BaseCoordinates)) { MoveTo(BaseCoordinates); } }
public void MoveTo(Coordinates coordinates) { Thread.Sleep(100); if (!NextCoordinates.IsLocatedIn(coordinates)) { NextCoordinates.ShiftTo(coordinates); } }
public void Repair() { while (!NextCoordinates.IsLocatedIn(Warehouse.Coordinates)) { MoveTo(Warehouse.Coordinates); } Thread.Sleep(1000); Warehouse.NeedMechanic = false; Warehouse.Workload = 0; Warehouse.ImageId = 1; MoveToHome(); }
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]); } } }
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); } } }
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); }
public bool InBaseCoordinates() { return(NextCoordinates.IsLocatedIn(BaseCoordinates)); }