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

Practice real SQL in BigQuery with the public E-commerce dataset

WebUI of BigQuery

Implementing a Dynamic IP with Domain Hosted on DigitalOcean

The Scrum Master’s Role: Playing Support

6 Ways to Apply CompTIA Security+ Material with Python

Python XPath 2.0 with Elementpath

SpaceGate uses a variety of indications

Week 3 — Building Something from Scratch Phase: Learning from Mistakes

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

Level Design in Unity Part 2: The Walls

Creating the Main Menu

Using Decals in Unity

Tessellation in HDRP