# Weapon Manager

## Overview

This component manages all the weapons of the character

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FepPvM5C1f7Hsg2s6b1RH%2Fimage.png?alt=media&#x26;token=8458fa6a-f8b1-4de3-bd1d-3c52280217b1" alt=""><figcaption></figcaption></figure>

It controls features like store/draw - equip/unequip weapons that you want to use while riding or grounded and allows attacking with them. In order for the weapons to get recognized by the Weapon Manager component, they need to have any of the MWeapons components provided.

* **MMelee** for Melee weapons
* **MShootable** for projectile weapons
* **MBow** for Bow&#x20;

These weapons will provide core data to activate Modes in the Animal Controller.

***

## General

#### Start Weapon

Set a weapon on this parameter to let the character start with a weapon already equipped.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fw5uY0Z8G3wGT6O10z397%2FUnity_omPQWgff1Y.gif?alt=media&#x26;token=edc225e3-0700-4f26-a9a8-31fa81a6aa35" alt=""><figcaption></figcaption></figure>

#### Ignore Draw

Ignores the Draw | Unsheathe animations and equips the weapon instantly

#### Ignore Store

Ignores the Store | Sheathe animations and unequips the weapon instantly

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FwmSwgLLw8o36VSTtngSw%2FUnity_VBfnDTa6J1.gif?alt=media&#x26;token=67b8ec0d-4083-4d2b-9aa7-38a8c900f1b9" alt=""><figcaption></figcaption></figure>

#### Store After

The weapon will be automatically stored after a given time if that weapon has not been used. Use this if you are using the Instant weapon Equip/Attack method (Assasin Creed's Style)

#### Weapon Hand Equip Points (Left and Right)

Transform References for the Right and Left Hands of the Character. The weapons will be parented to any of these Transforms when are equipped. Right-handed weapons will be parented to the right hand, and left-handed weapons to the left hand.&#x20;

#### Ignore Hand Offset

When parenting the Weapon to any of the Equip points, the Weapon offsets value will be ignored.

***

## Holsters and External

You can change between Use Holsters and Use External.&#x20;

&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FZRq2HwtiEip6JOW8tinx%2FUnity_tPvLwY3Yw3.gif?alt=media&#x26;token=5edfc32e-d035-4cd4-a94c-d4c8f32e9983" alt=""><figcaption></figcaption></figure>

**Use Holsters** will get the weapons received and parented to an internal holster inside the character

**Use External** will equip directly the given weapon in the character's hands.&#x20;

***

### Use Holsters&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FeIeDNhAIvlEKBT6RuOyt%2Fimage.png?alt=media&#x26;token=70e98dc5-293b-4ea0-8ccf-f6e59e8bed25" alt=""><figcaption></figcaption></figure>

When you set the Weapon Manager to **use Holsters,** the weapons will use the Holster ID parameter to check where the weapons are going to be stored in the Character.&#x20;

E.g. If a Sword has and Holders ID equal to \[Left Holster], when that sword is picked up, it will be stored in that holster Slot Transforms.

{% hint style="info" %}
**Holsters ID** also works as the Animator Value to play the correct sheathe and unsheathe animations when equipping/unequipping a weapon
{% endhint %}

#### Holster Time

This will smoothly parent a weapon from the holster to the Hand and vice versa.

Set it to zero to instantly parent the weapon.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FhO6oTB9oCsZ1XbP6bSzU%2FUnity_YvDk6uMyCJ.gif?alt=media&#x26;token=1059a0b9-e9e2-4020-a4e3-d47a748a94b6" alt=""><figcaption></figcaption></figure>

#### Holster ID List

Add all the holsters your character is going to use.&#x20;

#### Holster ID

ID value used to Identify the holster in the  Weapon and in the Weapon Manager, to parent the weapon to the correct holster.

By default, there are 5 Holsters Created. You can create more by just duplicating any of the holsters created. Just make sure the ID value does not repeat.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FEDlHmuyL97FlkjJ76LEZ%2Fimage.png?alt=media&#x26;token=eedc3098-ad10-4c8a-9bb1-05936e4ee090" alt=""><figcaption></figcaption></figure>

The value is also used on the Weapon Manager Animator Transitions. the ID Value and the Draw/Store Weapon Actions are combined to identify which animation will be played.&#x20;

E.g. Storing a weapon with a Right Hand, to the Left Holster, uses the Transition conditions:      Mode = 98001; LeftHand = false.

&#x20;StoreID \[98]\*1000 + Left HosterID\[1] = 98001 . (Its the same formula used to Play Modes)

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FpO98DMuN9cgmDei5OOWp%2Fimage.png?alt=media&#x26;token=3e803212-4521-4a38-a665-2c68da4460ed" alt=""><figcaption><p>[Store] Action Value is 98. [Draw] Action value is 99.</p></figcaption></figure>

#### Weapon

You can add a weapon to a holster, so the character starts with a weapon on the holster in Play Mode. **Just make sure the weapon set on the holster has matching IDs.** (Sword with Left Hoster ID must be equipped on the Left Holster).

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FTp2Y8sVV1OBjcLNHdEF7%2FUnity_nLJUPwvRqW.gif?alt=media&#x26;token=5e0f4dba-9214-43ab-a8bb-e592f6d55c7b" alt=""><figcaption></figcaption></figure>

#### Input

Input Value set to automatically connect the Input to Unsheathing/Sheathing a weapon from a holster. (In the Demo Scenes you can draw/store weapons using \[4] key for the left holster )

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FiTzoqESF1VLPlnQ1vZdH%2FUnity_tLutSWiQKo.gif?alt=media&#x26;token=5a4613ee-90f0-4ddb-819b-31cad002384c" alt=""><figcaption><p>Pressing 4 will equip the weapon stored in the Left Holster</p></figcaption></figure>

#### Slot List

These are Transform references to parent the weapon on a Holster. A holster can have more than one slot. Meaning that weapons using the same holster can be parented to different slots.

E.g. The Sword and the Spear share the same Holster <mark style="color:orange;">**(Left Holster)**</mark> but the sword is parented to the **Hip Slot**, and the Spear is parented to the **Back Slot.**

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F7XDdLNCWxpS2nsoXRT8V%2FUnity_9XzxTwJS07.gif?alt=media&#x26;token=2ec97e5b-4a1a-4890-bf16-bc756dd53326" alt=""><figcaption></figcaption></figure>

***

### Use External

This option will equip directly the given weapon in the character's hands.&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FDuz8QFmCI3jNOMgXS4Wh%2Fimage.png?alt=media&#x26;token=65b7390b-1297-45d0-9a47-9a9b21c5baa7" alt=""><figcaption></figcaption></figure>

Use this option if you don't want the weapons to be resting in the character, they will be instantiated directly on the hands.&#x20;

This is also used for external integrations that already have their own weapon system (Invector)

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FwDl7mpx2hB43D4EqUopG%2FUnity_OOnlFYyw9O.gif?alt=media&#x26;token=a7659dea-7dd6-4841-bfe9-0706680ad699" alt=""><figcaption></figcaption></figure>

#### Instantiate On Equip

When the weapon is added to the weapon manager using Equip\_External(GameObject) it wil instantiate the weapon if its a prefab

#### Destroy On Unequip

When the current active weapon is unequipped the weapon will be destroyed. When using an external system that already destroys or hide the weapon, Disable this option.

***

## AC Animal Controller

All the related animal controller parameters are configured in this tab.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FzDN8P5dp3eIa8AbSH79x%2Fimage.png?alt=media&#x26;token=c1360f06-3117-4457-89da-6f243940ae3d" alt=""><figcaption></figcaption></figure>

#### Animal

Reference to the Animal Component

#### Mode \[Draw Weapon]

Which Mode is set to Draw/Unsheathe weapons

#### Mode \[Store Weapon]

Which Mode is set to Store/Sheathe weapons

#### Mode \[Unharmed]

Which Mode is set to unharmed attacks (Default attacks)

#### Combo Manager

Reference for the Combo Manager Component

#### Disable Modes

When a weapon is equipped, Modes on this list are going to be disabled

#### Exit on States

When a weapon is equipped and a state of this list gets activated, the weapons will be temporarily stored, and when the state exits, the weapons will be equipped again.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fg6uhiopPpGQlXx6VPgpa%2FUnity_2ubrDUIG98.gif?alt=media&#x26;token=ab3ddc30-b27d-418c-968d-7b5f9d6b4766" alt=""><figcaption><p>Adding Climb to the list will store the weapon while climbing</p></figcaption></figure>

#### Exit on Modes

When a weapon is equipped and a Mode of this list gets activated, the weapons will be temporarily stored, and when the mode exits, the weapons will be equipped again.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F7c1NPBJzvniXVtGAPVpU%2FUnity_VzOGSIVkrn.gif?alt=media&#x26;token=b90849a7-8efe-477c-afe3-f5c55c14c664" alt=""><figcaption><p>The weapon will be holstered when a Mode is playing (E.g. Action Mode -> Vault and Slide)</p></figcaption></figure>

#### Exit Fast&#x20;

When enabled the weapons will be unequipped fast on the States, and they will not show the Draw/Store Animations

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FbPoB12EuclDx5tUtXWhP%2FUnity_C37wpJOJwW.gif?alt=media&#x26;token=1f3110e6-b60d-44dd-afb6-6b0ccd28f5eb" alt=""><figcaption></figcaption></figure>

***

## Events

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FMdOwfhmRwJwPtFDhZ7pg%2Fimage.png?alt=media&#x26;token=16507bb6-1c80-4c8c-b813-595868aa8620" alt=""><figcaption></figcaption></figure>

#### OnCombat Mode (Boolean)

Invoked true when a weapon is equipped, and false when a weapon is stored

#### On Can Aim (Boolean)

Invoked when the weapon is aiming. Sends true or false if it's aiming

#### On Equip Weapon (GameObject)

Invoked when a weapon is equipped. Sends the equipped weapon

#### On Unequip Weapon (GameObject)

Invoked when a weapon is unequipped. Sends the unequipped weapon

#### On Weapon Action (int)

Invoked when the weapon changes its current action. See List of actions in the Animator Tab

***

## Inputs

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FD1IgCTgInV8m4Y6oJSK0%2Fimage.png?alt=media&#x26;token=7c8e84cc-2d51-4574-bafb-acbd79172765" alt=""><figcaption></figcaption></figure>

#### Aim Input

Input name to execute the Aim Logic

#### Reload Input

Input name to execute the Reload Logic

#### Main Attack

Input name to execute the Main Attack Logic

#### Second Attack

Input name to execute the Secondary Attack

### Holster Inputs

If the Holster Option is enabled. All the Holster Inputs will be also shown in this Tab

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fsu8oLRqmcQYqvz3387Vv%2FUnity_TnzSbOfyLy.gif?alt=media&#x26;token=fd36f1b6-2a92-4a00-8d1a-94fa65ebc78e" alt=""><figcaption></figcaption></figure>

***

## Advanced

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FiNWcLLY7U6US4K4LCNSX%2Fimage.png?alt=media&#x26;token=194fdbdb-b700-49f1-ad24-8fcd155d47f1" alt=""><figcaption></figcaption></figure>

The Advanced section was created to add the Layer Animation on other Animator components like Invector.&#x20;

If the Upper Body Weapon Layer is not found in the current animator a Green Button will be shown to add it manually.

***

## Animator

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FSd2zrnVcqmYnvL18spvo%2Fimage.png?alt=media&#x26;token=cbf5845c-219a-4328-9be9-2eb143604a7b" alt=""><figcaption></figcaption></figure>

#### Anim

Reference for the Animator Controller

#### Weapon Type

Name of the Weapon-Type animator Parameter

#### Left Hand

Name of the Left-Hand animator Parameter

#### IK Free Hand

Name of the IK-Free-Hand animator Parameter

#### IK Aim

Name of the IK Aim animator Parameter

***

## Debug

At runtime. Important logic will be printed in the console. Also in the inspector, all the internal variables will be exposed to show all the changes at runtime

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FHNpblfGxYOAf2uDUlXmd%2Fimage.png?alt=media&#x26;token=32a2e63f-aafa-4874-96d7-31ace4099e28" alt=""><figcaption></figcaption></figure>
