private void stopSystem() { timerRefresh.Enabled = false; timerLift.Enabled = false; Invalidate(); persons.Clear(); floors.Clear(); sumPersons = 0; lift = Lift.newInstance(); }
private void createLiftInBuild() { int[] mass = new int[floors.Count]; for (int i = 0; i < mass.Length; i++) { mass[i] = floors[i].PositionY; } lift = Lift.getInstance(numberOfFloor, positionX + 430, floors[0].PositionY, mass); g.DrawImage(Properties.Resources.lift, lift.PositionX, lift.PositionY); }
public static Lift getInstance(int countButtons, int positionX, int positionY, int[] coordinate) { if (lift == null) { lock (syncRoot) { if (lift == null) { lift = new Lift(countButtons, positionX, positionY, coordinate); } } } return(lift); }
public bool NextMove() { Lift lift = Lift.getInstance(0, 0, 0, new int[] { 0, 0 }); if (positionX < lengthFloor && !moveInLift && !exitFloor) { positionX_old = positionX; positionY_old = positionY; positionX += speedX; } else if (!wait && !moveInLift && !exitFloor) { wait = true; status = "Ждёт на этаже " + (numberFloor[0] + 1); lift.callTheElevator(numberFloor[0], numberFloor[1]); } else if (numberFloor[0] == lift.CurrentFloor && !moveInLift && !exitFloor && lift.Weight < 400) { enable = false; moveInLift = true; lift.Weight = weight; lift.sumWeight = weight; lift.MoveUp = false; status = "Движется на нужный этаж"; lift.moveTheElevator(numberFloor[0]); } else if (numberFloor[1] == lift.CurrentFloor && moveInLift && !exitFloor) { enable = true; exitFloor = true; positionY = lift.PositionY + 15; lift.Weight = -weight; lift.MoveUp = false; status = "Уходит на этаже " + (numberFloor[1] + 1); lift.exitTheElevator(numberFloor[1]); } else if (exitFloor) { positionX_old = positionX; positionY_old = positionY; positionX -= speedX; } return(enable); }
public bool NextMove() { Lift lift = Lift.getInstance(0, 0, 0, new int[] { 0, 0 }); if (positionX < lengthFloor && !moveInLift && !exitFloor) //движется от двери к лифту { positionX_old = positionX; positionY_old = positionY; positionX += speedX; } else if (!wait && !moveInLift && !exitFloor) //ожидает лифта на своем этаже { wait = true; status = "Ждёт на этаже " + (numberFloor[0] + 1); lift.callTheElevator(numberFloor[0], numberFloor[1]); } else if (numberFloor[0] == lift.CurrentFloor && !moveInLift && !exitFloor && lift.Weight + weight < 400) //едет в лифте { enable = false; moveInLift = true; lift.Weight = weight; lift.sumWeight = weight; lift.MoveUp = false; status = "Движется на нужный этаж"; lift.moveTheElevator(numberFloor[0]); } else if (numberFloor[1] == lift.CurrentFloor && moveInLift && !exitFloor) //выходит из лифта { enable = true; exitFloor = true; positionY = lift.PositionY + 15; lift.Weight = -weight; lift.MoveUp = false; status = "Выходит на этаже " + (numberFloor[1] + 1); lift.exitTheElevator(numberFloor[1]); } else if (exitFloor) //движется к двери после выхода из лифта { positionX_old = positionX; positionY_old = positionY; positionX -= speedX; } return(enable); }
public static Lift newInstance() { lift = null; return(lift); }