# Detailed Setup

### Demo Scene Example

{% hint style="info" %}
You can get a quick start using the **Lever Demo Scene** prefab object and drag that straight into your scene. This will everyone to be already setup.
{% endhint %}

### **Tag & Layer Setup**

{% hint style="info" %}
**Player:**&#x20;

* 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!
  {% endhint %}

## System Setup

### Step 1 - Player Setup

{% hint style="info" %}

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.
   1. You can set the **Interact Distance**
   2. The tag used to detect object in-front&#x20;
   3. Add Lever UI prefab to your scena and Add UI Crosshair to the interactor slot
   4. Choose the interact key input for interaction with the levers
      {% endhint %}

<figure><img src="https://3938358402-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZd3MS9LFbeyIQGU6AmI%2Fuploads%2FFhz3bxBND5uo3CtvZz9p%2FLeverInteractor.JPG?alt=media&#x26;token=0de3935b-fb4f-4f54-8853-cc75479a1f61" alt=""><figcaption></figcaption></figure>

### Step 2 - Audio Manager Setup

{% hint style="info" %}

1. Add an Audio Manager to your scene from the prefab folder
2. Add the ScriptableObjects sound effects, found in the ScriptableObject folder to the size array of sounds. This should already be setup for you:&#x20;
   {% endhint %}

![](https://3938358402-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZd3MS9LFbeyIQGU6AmI%2Fuploads%2FKIsaEEOG2XbCzTdgAXXz%2FAudioManager.JPG?alt=media\&token=cee6fc6a-5957-499f-be38-7e9b504e4757)

### Step 3 - Adding Levers

{% hint style="info" %}

1. 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
   {% endhint %}

![](https://3938358402-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZd3MS9LFbeyIQGU6AmI%2Fuploads%2FLd9fu1ze43okicNgu820%2FLeverSet_Objects.JPG?alt=media\&token=ed394aa6-285d-427c-a508-da404cb1efe7)

{% hint style="info" %}
2\. You can see the individual lever setup below:&#x20;

1. Set the tag to **InteractiveObject** (The tag you specified in the Raycast script on the Main Camera)
2. A box collider
3. Add a **LeverItem** script to this object (If not already)
   1. Set the **ObjectType** to: **Lever**
   2. Set the number you want this lever to have, based on your order
   3. Set the animation name for this item, the default is **Handle\_Pull**
   4. Add the **Controller** reference, which we will add in the later stage of this setup
      {% endhint %}

![](https://3938358402-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZd3MS9LFbeyIQGU6AmI%2Fuploads%2F8mFauKNRBVrJ8JDVdy5d%2FLever.JPG?alt=media\&token=d35c3aec-4435-4b11-be3a-ca0b53e8ccb8)

### Step 4 - Adding the Control Box

{% hint style="info" %}

1. Add a **ControlBox** prefab to your scene, which will have:&#x20;
   1. Component Models (These are added to the System controller, scroll down further)
   2. Interaction Buttons (Setup below)
      {% endhint %}

![](https://3938358402-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZd3MS9LFbeyIQGU6AmI%2Fuploads%2Fdg7T3pIuuquSol0DLd8L%2FControlBox_GameObjects.JPG?alt=media\&token=c8c66869-3f66-459a-a92b-8ac3d8eb6605)

### Step 5 - Interactive Button Setup

{% hint style="info" %}
Setup details are below

1. Tag: **InteractiveObject**
2. Box Collider
3. **Lever Item** script&#x20;
   1. Test Button or Reset Button depending on the button type
4. Animation Name: **RedButton\_Push**
5. Add the controller of the system below:
   {% endhint %}

![](https://3938358402-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZd3MS9LFbeyIQGU6AmI%2Fuploads%2FrJR8N28zuygoCUSRNKxw%2FInteractiveButton.JPG?alt=media\&token=abd7a26f-1255-4065-8c54-03ffd292119b)

### Step 6 - Lever System Controller

{% hint style="info" %}

1. Add a **Lever System Controller** to your scene, this will have a **Lever System Controller** script attached, see the setup below:&#x20;
   {% endhint %}

![](https://3938358402-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZd3MS9LFbeyIQGU6AmI%2Fuploads%2F1JDgt2PeWWiutZTBJ5O2%2FLeverController_Closed.JPG?alt=media\&token=71f8ab8f-e30a-4b0f-9df8-1502ffe74302)

|                     |                                                                                                                           |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| 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                             |

{% hint style="info" %}
Below is the controller with all options opened out, so you can see all the basic references
{% endhint %}

![](https://3938358402-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZd3MS9LFbeyIQGU6AmI%2Fuploads%2FUbu8woStxUdhivAjN6VZ%2FController_Open.JPG?alt=media\&token=18a9bb4f-c894-40a8-a25a-c65938931bb0)

### Step 7 - Power Up Event

{% content-ref url="../support/power-up-event" %}
[power-up-event](https://speedtutoruk.gitbook.io/lever-system/support/power-up-event)
{% endcontent-ref %}

{% hint style="info" %}
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!
{% endhint %}

![](https://3938358402-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZd3MS9LFbeyIQGU6AmI%2Fuploads%2FZU6mL0FtLsEXNq5njYj1%2FPowerUpEvent.JPG?alt=media\&token=8ad7ec95-7161-490d-be46-0af6c0e9ebc5)

![](https://3938358402-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZd3MS9LFbeyIQGU6AmI%2Fuploads%2FBmLH1246LfsHjR3cRjdm%2FActivateLights.JPG?alt=media\&token=5166104c-908b-482f-b480-b56548c6cc7a)

### Using The Lever System

{% hint style="info" %}

1. Pull the levers in the order you wish
2. When the limit is reached, the system must be reset you will see the button light. No interactions can happen until **Tested** or **Reset**
3. Use the **Test** button to test the current order you have set, resetting will happen if the order is incorrect
4. Use the **Reset** button to reset your current order
   {% endhint %}

### Indicators Explained

{% hint style="info" %}

1. **Ready:** You can start pulling levers
2. **Limit Reached:** When the pull limit is reached&#x20;
3. **Accepted:** When the order has been "Tested" and correct
4. **Resetting:** The system is resetting the order, ready to use again
   {% endhint %}

![](https://3938358402-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZd3MS9LFbeyIQGU6AmI%2Fuploads%2FZtQrvbhdq8kj3IK4ppFV%2FBoxCrop.png?alt=media\&token=fb7dac79-abb3-4e23-84ab-c445fad73967)
