Detailed Setup
Last updated
Last updated
NOTE: You can get a quick start using the Lever_Entire_DemoScene prefab object and drag that straight into your scene. This will everyone to be already setup, you can delete the art assets as required but checkout the demo scene if you’re confused!
Player:
Layer of: Ignore Raycast
Any Interactable Object:
Tag InteractiveObject or as per the raycast script on the main camera, it will have the tag you need!
1). Add an FPSController to your scene. (Unless you’re using the demo which will already have one added, but the package will be required to be imported before use). Please navigate to the scripts folder and add the LeverInteractor script to your MainCamera (If not already.
You can set the Interact Distance
The tag used to detect object in-front
2). Now drag the managers from the Prefabs folder into the hierarchy. You will need to add a UIManager / AudioManager / InputManager NOTE: Only drag this prefab into the hierarchy, not the scene.
3). UIManager: Add the crosshair image from the Crosshair- Canvas components to the LeverUIManager crosshair slot in the inspector.
4). AudioManager: Add the ScriptableObjects sound effects, found in the ScriptableObject folder to the size array of sounds. This should already be setup for you:
5). InputManager: Select the Input you wish to use for the system
6). Add a set of levers to your scene, the prefab will have a folder called Levers_1 - which will include 5 levers. You can duplicate these objects if you wish to have more or less for ONE SINGLE controller:
7). You can see the individual lever setup below:
Set the tag to InteractiveObject (The tag you specified in the Raycast script on the Main Camera)
A box collider
Add a LeverItem script to this object (If not already)
Set the ObjectType to: Lever
Set the number you want this lever to have, based on your order
Set the animation name for this item, the default is Handle_Pull
Add the Controller reference, which we will add in the later stage of this setup
8). Add a ControlBox prefab to your scene, which will have:
Component Models (These are added to the System controller, scroll down further)
Interaction Buttons (Setup below)
8b). Interactive Button Setup:
Tag: InteractiveObject
Box Collider
LeverItem script
Test Button or Reset Button depending on the button type
Animation Name: RedButton_Push
Add the controller of the system below:
9). Add a Lever System Controller to your scene, this will have a Lever System Controller script attached, see the setup below:
Below is the controller with all options opened out, so you can see all the basic references
10). Power Up Event
This is the power up event, I have created a basic script called ActivateLights, which is a public method to change emission and activate some GameObjects. You can add whatever you want here, whether that's opening a door, turning on a generator or more!
Using the Lever system:
Pull the levers in the order you wish
When the limit is reached, the system must be reset you will see the button light. No interactions can happen until Tested or Reset
Use the Test button to test the current order you have set, resetting will happen if the order is incorrect
Use the Reset button to reset your current order
The indicators at the top show what's current active:
Ready: You can start pulling levers
Limit Reached: When the pull limit is reached
Accepted: When the order has been "Tested" and correct
Resetting: The system is resetting the order, ready to use again
Lever Order
The order the levers need to be pulled to complete the sequence, match this will the numbers you set on the lever objects
Pull limit
What is the limit of the pull order, make sure it's the number of levers you have
Pull Timer
The timer you must wait before another lever can be pulled, can stop unnecessary double interactions
Interactive Objects
Add all the the levers and interactive buttons to this array. By default there will be 7 slots
Switches
Add all of the switches inside the "Control box"
Lights
Add all the lights inside the "Control box"
Buttons
Add all the buttons inside the "Control Box"
Animation Names
These are the animation names for the objects, defaults are usually ok
Sound Effects
Add the ScriptableObject audio effects for the system
Power Up Event
This is the event that will happen when the levers are pulled in the correct order and tested