Riding the elevator in Unity
Now, it’s time for the player take a ride on the elevator. He needs to press the panel again to up. However, how can the Player press the panel while on the platform when it’s far away?
The solution can be simple. All we need to do is to increase the collider of the panel:
When the Player presses the elevator panel again, it must go up. To refactor the code, instead of using if statements we can assign the _isGoingDown variable to its opposite value.
In the ElevatorPanel, I added a cooldown for the Elevator indicator so that the green indicator turns own for two seconds then turn back to red after being called.
Now, the Player can go up.
There are some jitters which we will fix in the next article.