Lever Puzzle Sys - Setup
Basic Steps
I'd recommend adding the "LeverSystem_Objects" from the "Prefabs > Individual_Prefabs > Single Objects" section this should include a:
"SwitchBox_Model" object (With Interaction_Colliders)
"LeverController_1" (With power levers)
"LeverController_1" should have a:
"LeverSystemController" script attached
Tag of "LeverController"
Inside the "LeverController_1" object should be the power levers - They should have:
Tag of "InteractiveObject"
Layer of "Interact"
Box Collider attached
AKItemController script - Primary set to "Lever Sys"
LeverItemController script - Set to "Lever"
LeverController script
Set the number to the number you want this lever to be in the sequence
Set the animation name, the default is "Handle_Pull"
Add the "LeverController_1" object to this slot
The SwitchBoxModel > InteractionColliders
TestButtonCollider & ResetButtonCollider should have:
Tag "InteractiveObject"
Layer "Interact"
Add a "Box Collider"
AKItemController set to "Lever Sys"
LeverItemController set to "Test Button" and "Reset Button" respectively
LeverController script with just the "LeverController_1" object adding to the bottom slot
If you're using more than one instance of this puzzle in the same scene, duplicate the entire "LeverSystem_Objects" folder to make a clone
Lever System Objects Setup
I have created a basic setup for organising the system, an empty gameobject to hold all of the lever assets:
LeverController
SwitchBox_Model
Lever Controller Setup
This object should be an empty GameObject and it will control everything that goes on for your lever system!
Make sure this object has a "LeverSystemController" script attached
In-game order (Used for debugging ONLY):
Custom Order:
Pull Limit:
Timer before being allowed to pull the next lever:
Add all of the required objects to the array:
Control Box Switches:
Control Unit Lights:
Accept / Reset Buttons:
Switch Object - Animation Names:
Audio Sounds:
Unlock Events:
You can use the "+" icon to add an event for when you get the correct code, you can add custom interactions if you create a new script with a public method to spawn objects, or some other type of interaction when the combination for the levers is complete.
Power Lever Setup
Add this script to a 3D Keypad model from the prefabs or one you may have created yourself
Make sure your object has a tag of "InteractiveObject"
Layer of "Interact"
Add a "Box Collider" to your object
Add an "AKItemController" - Set the System Type to: "Lever Sys"
Add a "LeverItemController" script to the object - Set to "Lever"
Add a "LeverController" script
Set the number of the lever in the script for your order
Add the name of your animation for the lever pulling (Default is "Handle_Pull")
In the "LeverSystemController" slot - Add the "LeverController_1" to this slot
Test & Reset Buttons
Do the same as above but set the "ObjectType" in the "LeverItemController" script to either "Test Button" or "Reset Button" depending on the button you want to add!
Default Controls
Left Click to interact with the levers or switches
You can change these in the "InputManager"
Last updated