Exemplo n.º 1
0
        public void MoveToNextStop()
        {
            Console.WriteLine("Buss number: " + this.GetNum() + " is moving to next stop");
            this.toggleTransit();
            this.currentstop.addBuss(this.currentstop.stop.popBuss()); //moving buss from loading queue to traveling queue

            for (int sleepcount = 1; sleepcount < 30; sleepcount++)
            {
                Thread.Sleep(10000);
            }

            while ((this.currentstop.getFrontbuss()).GetNum() != this.GetNum())//waits for this buss to be at the front of the queue and is simulating 5 minutes of 'travel' time, cant do it in one sleep command because it takes an int32 input for milliseconds
            {
                for (int sleepcount = 1; sleepcount < 30; sleepcount++)
                {
                    Thread.Sleep(10000);
                }
            }
            currentstop.popBuss(); //removes buss from travel queue once it sees that its at the front
            currentstop = currentstop.GetNext();


            currentstop.stop.addBuss(this); //adds buss to end of new stops queue as it arrives
            this.toggleTransit();
        }
Exemplo n.º 2
0
 public void setStop(BussRoute.RouteWrapper newstop)
 {
     currentstop = newstop;
 }