Exemplo n.º 1
0
        public Elevator()
        {
            ElevatorState = State.Wait;

            WaitFloors = new List <Floor>();
            for (int i = 1; i <= 10; ++i)
            {
                WaitFloors.Add(new Floor(i));
            }

            ComeToFloors = new List <Floor>();
            for (int i = 1; i <= 10; ++i)
            {
                ComeToFloors.Add(new Floor(i));
            }

            Doors = new Doors();

            CurrentFloor = 0;

            go = 0;

            EventGoUp              += GoUp;
            EventGoDown            += GoDown;
            EventWaitWithOpenDoors += WaitWithOpenDoors;
            EventWait              += Wait;
            EventOpen              += Open;
            EventClose             += Close;

            EventWait?.Invoke();
        }
Exemplo n.º 2
0
        public void SetWaitFloor(int i)
        {
            WaitFloors[i - 1].SetWait();

            if (ElevatorState == State.Wait)
            {
                EventWait?.Invoke();
            }
        }
 public void CallEventWait()
 {
     EventWait?.Invoke();
 }