Unity/C# Challenge 51: The Elevator Problem Pt 3.

Alec Oney
Nov 22, 2021

Challenge: Implement our elevator movement downwards.

Now that our elevator panel is set up, we want to create logic that governs moving the elevator down. Fundamentally, this is going to look like our platform movement script, using the movetowards function. First, we create an elevator script, attach it to our elevator, and modify our elevator panel script so:

Now, when our elevator panel script starts, it will find the elevator component. When the player calls the elevator, the callElevator method will run. This method will be accessed in our elevator script, which we will modify like so:

with origin and target being where you want the elevator to end up.

Now, when we call the elevator, it will move down:

Next, we need to move the elevator up.

--

--