Example #1
0
    public List <string> removePilotsForTransfer(EmployeeTransfer et)
    {
        // Unless we're removing all the pilots, we have to save the pilot on the aircraft.
        string busyPilot = null;

        if (et.getPilots() < getNumbPilots() && aircraft != null && aircraft.hasPilot())
        {
            // Remove the pilot from hired pilots
            busyPilot = aircraft.getPilot();
            hiredPilots.Remove(busyPilot);
        }
        List <string> removedPilots = new List <string>();

        for (int i = 0; i < et.getPilots(); i++)
        {
            string pilot = hiredPilots.Last.Value;
            hiredPilots.Remove(pilot);
            removedPilots.Add(pilot);
            occupiedLivingSpace--;
        }
        if (busyPilot != null)
        {
            // Restore the pilot to hired pilots
            hiredPilots.AddLast(busyPilot);
        }
        return(removedPilots);
    }
Example #2
0
    public void addPilotsForTransfer(EmployeeTransfer et, List <string> pilots)
    {
        if (et.getPilots() != pilots.Count)
        {
            Debug.Log("Something went wrong");
        }

        foreach (string p in pilots)
        {
            this.addHiredPilot(p);
            occupiedLivingSpace++;
        }
    }
Example #3
0
 public List<string> removePilotsForTransfer(EmployeeTransfer et)
 {
     // Unless we're removing all the pilots, we have to save the pilot on the aircraft.
     string busyPilot = null;
     if (et.getPilots() < getNumbPilots() && aircraft != null && aircraft.hasPilot())
     {
         // Remove the pilot from hired pilots
         busyPilot = aircraft.getPilot();
         hiredPilots.Remove(busyPilot);
     }
     List<string> removedPilots = new List<string>();
     for (int i = 0; i < et.getPilots(); i++)
     {
         string pilot = hiredPilots.Last.Value;
         hiredPilots.Remove(pilot);
         removedPilots.Add(pilot);
         occupiedLivingSpace--;
     }
     if (busyPilot != null) {
         // Restore the pilot to hired pilots
         hiredPilots.AddLast(busyPilot);
     }
     return removedPilots;
 }
Example #4
0
    public void addPilotsForTransfer(EmployeeTransfer et, List<string> pilots)
    {
        if (et.getPilots() != pilots.Count) Debug.Log("Something went wrong");

        foreach (string p in pilots)
        {
            this.addHiredPilot(p);
            occupiedLivingSpace++;
        }
    }