Creating an Elevator (part 1)

Creating the complex system of calling an Elevator and rising up

Our task for the elevator function is going to require several parts to work together. The first condition is to have an total amount of 8 points to be able to call the elevator.

Then when the player reaches access point, we need a visual prompt to tell the player to push and certain key input (ie. pressing the “E” Key to activate the elevator) There will be several other user feedback including a Light which turns color.

Once the player is on the elevator, and only when the player is on the elevator will the elevator start to rise up.

With these steps lay outed, we will need to slowly implement these functions step by step.

The Elevator Panel:

Logically analyzing the break down of the elevator process, we should noticed that the elevator panel is the target for controlling and triggering everything including checking for collision of the player. Therefore we will place the majority of the scripts within this game object.

The elevator Trigger Panel

Create a new C# script and named it “Elevator Panel” and drag the script into the game object.

First we are going to focus on something simple, when the player reaches the Elevator Panel and presses the E button. We just want the red light to change to blue. To do this, we will rely on the On Trigger Stay method which basically triggers the set condition whenever the player is within the collider. Then we are going to check the other tag to see if it is the Player we are colliding with. Finally the final condition is checking for the E button input. When that button is pressed and only then, will the material for the light change color.

Remember to use On Trigger “Stay”

Back in Unity, once you drag in the Light object into the script slot, hit play to see if the color changes when all 2 conditions are met.

In the next article we will focus on activating the elevator.

A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Point and Click (part 2)

What Is Taxonomy in Digital Asset Management?

MQTT Beginners Guide

Tips to Choose the Best Infor Support Partner For Your Business

Microsoft interview tasks. Max Inserts to Obtain String Without 3 Consecutive ‘a’​.

How being a musician has made me a better web developer

Customizing Django’s User Model- Login Via Email, Customizing User registration Functions.

Harmony OS: How to release an app?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Simon Truong

Simon Truong

A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.

More from Medium

Skeleton Enemy

3rd Person Controller Using Cinemachine Virtual Camera On Mobile

Creating a Homing Projectile

Creating the Main Menu