Keypad Sys - Setup
Last updated
Last updated
How to add a trigger event to for this system?
I'd recommend adding the "Keypad_Objects" from the "Prefabs > Individual_Prefabs > Single Objects" section this should include a:
Keypad Controller Object
Keypad Canvas Object
Keypad Model Object
Keypad Door Object
Keypad_Controller should have a:
"KeypadKeyController" script attached
"KeypadController" script attached
Keypad_Canvas
Keypad Model should have a:
"AKItemController" script attached
"KeypadItemController" script attached
Box Collider attached
Tag of "InteractiveObject" and layer of "Interact"
Door object or similar with your custom script or the "KeypadDoorController"
I have created a basic setup for organising the system, an empty gameobject to hold all of the keypad assets:
Keypad_Controller
Keypad_Canvas
Keypad_Model
Keypad_Door
This object should be an empty GameObject and it will control everything that goes on for your flashlight system!
Make sure this object has a "KeyPadKeyController" and a "KeyPadController" script with custom settings!
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 open a door, or some other object. I have added a simple example "KeyPadDoorController". See the code below:
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" and a Layer of "Interact"
Add a "Box Collider" to your object
Add an "AKItemController" - Set the System Type to: "KeypadSys"
Add a "KeypadItemController" script to the object
KeypadController variable: Add the connected "Keypad_Controller" object
NOTE: This only needs to be done if you’re setting the canvas buttons yourself or if anything might be missing.
Select and open out your “KeypadCanvas” (In Hierarchy) to find all the elements.
Select any of the Button numbers, add an “OnClick()” event in the bottom right of the inspector by clicking the “+”. (Unless it already has one added, image below).
Add your “KeyPadController” object to the available slot (This will link the keycontroller script which exists on that object).
On the drop down on the right, (No function dropdown if nothing is selected) choose the “KeyController” option which will open out into more.
Choose “KeyController.KeyPressString”
You can then add whatever number or keyboard symbol you like in the slot below the dropdown. Continue this for each button available.
NOTE: Similar setup for the CLOSE / CLEAR / ENTER Button.
Select any of the input keys, add an “OnClick()” event in the bottom right of the inspector by clicking the “+”.
Add your “KeyPadController” to the available slot
On the drop down on the right, choose the “KeyController” option which will open out into more. Choose “KeyController.KeyPressClose” or “KeyController.KeyPressClr” or “KeyController.KeyPress.Ent” to the corresponding buttons.
Left Click to interact with a pickup
Use the "Esc" Key on each of the keypads to exit the keypad
You can change these in the "InputManager"
Valid Code
The string code for the player to match with their input
Character Lim
The amount of characters in your code
Code Text
The InputField from the Keypad Canvas
Keypad Canvas
The entire Keypad Canvas from the associated object
Trigger Event
Add the "Padlock Trigger" which will be a gameobject you create
IsPadlockTrigger
Tick if you're using a Padlock Trigger