public new void Move( Elevator Elevator ) { bool breakout = false; while( !breakout ) { if( Elevator.ReachedHighestOrLowestFloor ) { Elevator.SwitchDirection(); } if( Elevator.ThereAreWishesOnThisFloor ) { breakout = true; } if( Elevator.ThereAreWishesInMyDirection ) { switch( Elevator.Direction ) { case Defaults.Direction.Upward: { Elevator.CurrentFloor++; } break; case Defaults.Direction.Downward: { Elevator.CurrentFloor--; } break; }// switch }// if }// while Elevator.SetState( Defaults.State.FixedClosed ); }
public void Loop(Elevator elevator) { Syncronize.CloseDoor(); if( !elevator.ReachedEndOfShaft ) { if( elevator.FittingWishOnThisFloor ) { elevator.SetState( Defaults.State.FixedOpen ); return; } else if( !elevator.WishesInMyDirection && elevator.OppositeWishOnThisFloor ) { elevator.SetState( Defaults.State.FixedOpen ); return; } } else { elevator.SwitchDirection(); if( elevator.OppositeWishOnThisFloor || elevator.FittingWishOnThisFloor ) { elevator.SetState(Defaults.State.FixedOpen); return ; } } if( elevator.WishesInMyDirection ) { elevator.SetState( Defaults.State.Moving ); return; } //else if( elevator.OppositeWishOnThisFloor ) //{ // elevator.SwitchDirection(); // elevator.SetState( Defaults.State.FixedOpen ); // return; //} else if( elevator.WishesInMyOppositeDirection ) { elevator.SwitchDirection(); elevator.SetState( Defaults.State.Moving ); return; } else { elevator.TaskStatus = false; } }
public new void Move( Elevator Elevator ) { bool breakOut = false; do { // 3 sec warten auf Button5 Defaults.ManualResetEvent.WaitOne( 3000 ); switch( Elevator.UI.PassengersIO ) { case Defaults.MoreOrLess.More: Elevator.Passengers++; break; case Defaults.MoreOrLess.Less: Elevator.Passengers--; break; case Defaults.MoreOrLess.Neither: breakOut = true; break; } Elevator.UI.ResetPassengerIO(); // wieder Neither } while (!breakOut); if( Elevator.CheckForOverload() ) Elevator.SetState( Defaults.State.Overload ); if( Elevator.ReachedHighestOrLowestFloor || !Elevator.ThereAreWishesInMyDirection ) Elevator.SwitchDirection(); else Elevator.SetState( Defaults.State.FixedClosed ); }
public void Loop(Elevator elevator) { if( elevator.ReachedEndOfShaft ) { elevator.SwitchDirection(); } if(elevator.FittingWishOnThisFloor) { elevator.SetState(Defaults.State.FixedClosed); return; } else if( elevator.WishesInMyDirection ) { switch( elevator.Direction ) { case Defaults.Direction.Upward: { elevator.CurrentFloor++; Syncronize.SyncCurrentFloor(); } break; case Defaults.Direction.Downward: { elevator.CurrentFloor--; Syncronize.SyncCurrentFloor(); } break; } Log.AddEntry("Aktuelle Etage:" + elevator.CurrentFloor.ToString()); Syncronize.ResetMoveTimer(); Syncronize.ShowDirection(); return; } else if( elevator.OppositeWishOnThisFloor ) { elevator.SwitchDirection(); elevator.SetState( Defaults.State.FixedClosed ); return; } }