IEnumerator OnMouseDown() { if (Elevator_script.GetState() == Elevator_Hospital.State.Stop) { if (Elevator_script.GetCurrentFloor() == GetCurrentFloor()) { if (!Elevator_script.GetDoorOpen()) { if (Distance() < 2.0f) { Elevator_script.SetDoorOpen(true); } } else { Elevator_script.SetDoorClose(true); } } else { if (Elevator_script.GetState() == Elevator_Hospital.State.Stop) { if (Elevator_script.GetDoorOpen()) { Elevator_script.SetDoorClose(true); yield return(new WaitForSeconds(5.0f)); if ((GetCurrentFloor() - Elevator_script.GetCurrentFloor()) > 0) { Elevator_script.SetState(Elevator_Hospital.State.Up); } else { Elevator_script.SetState(Elevator_Hospital.State.Down); } } else { if ((GetCurrentFloor() - Elevator_script.GetCurrentFloor()) > 0) { Elevator_script.SetState(Elevator_Hospital.State.Up); } else { Elevator_script.SetState(Elevator_Hospital.State.Down); } } } } } }
IEnumerator OnMouseDown() { if (Elevator_script.GetCurrentFloor() < 3) { if (Elevator_script.GetState() == Elevator_Hospital.State.Stop) { if (Elevator_script.GetDoorOpen()) { Elevator_script.SetDoorClose(true); yield return(new WaitForSeconds(5.0f)); Elevator_script.SetState(Elevator_Hospital.State.Up); } } } }