/// <summary> /// Moves the elevator to destination floor. Called by button inside the elevator. /// </summary> public void MoveToFloor(int floorIndex) { Debug.Log("ElevatorController:: Move requested to floor index " + floorIndex); if (currentElevatorState == eElevatorState.STOPPED && currentFloorIndex != floorIndex) { currentElevatorState = eElevatorState.MOVING; targetFloorIndex = floorIndex; if (targetFloorIndex > currentFloorIndex) { currentElevatorMovement = defaultElevatorMovement; } else { currentElevatorMovement = -defaultElevatorMovement; } closeExternalFloorDoors(); closeDoor(); grabPlayer(); deactivateAllDoorways(); // We must activate the scene changing FPEDoorway so that the scene will change as we approach our desired floor. activateFloorDoorway(targetFloorIndex); } }
private void stopElevatorAtDestination() { elevatorPlatform.transform.position = floorLocations[targetFloorIndex].transform.position; currentElevatorState = eElevatorState.STOPPED; currentFloorIndex = targetFloorIndex; deactivateAllDoorways(); releasePlayer(); openExternalFloorDoor(currentFloorIndex); openDoor(); mySpeaker.Play(); }
/// <summary> /// Calls elevator to floor. Used by button outside elevator. /// </summary> public void CallToFloor(int floorIndex) { Debug.Log("ElevatorController:: Called to floor index " + floorIndex); elevatorPlatform.transform.position = floorLocations[floorIndex].transform.position; currentElevatorState = eElevatorState.STOPPED; currentFloorIndex = floorIndex; targetFloorIndex = floorIndex; openExternalFloorDoor(currentFloorIndex); openDoor(); mySpeaker.Play(); }