Пример #1
0
 public void updateDroneState(DroneCtrl drone)
 {
     if (drone.status == DroneCtrl.Status.homing && supplyPoints.Count > 0)
     {
         Area drone_area = new Area(drone.transform.position);
         var  res        = supplyPoints_.FindMin(x => Area.distance(x, drone_area));
         drone.setDestination(res);
     }
     else if (drone.status == DroneCtrl.Status.idle)
     {
         assignDrone(drone);
         SearchAndDestroy();
     }
 }
Пример #2
0
 private void assignDrone(DroneCtrl drone = null)
 {
     // TODO:droneがnullならば暇なドローンを探して需要点を割り当て
     if (drone == null)
     {
         var res = (from x in drones_ where x.status == DroneCtrl.Status.idle select x).FindMin(x => Area.distance(new Area(x.transform.position), demandPoints.Last()));
         res.setDestination(demandPoints.Last());
         demandPoints_.RemoveLast();
     }
     else if (demandPoints.Count > 0)
     {
         Area d_area = new Area(drone.transform.position);
         var  res    = demandPoints_.FindMin(x => Area.distance(x, d_area));
         drone.setDestination(res);
         demandPoints_.Remove(res);
     }
 }