> For the complete documentation index, see [llms.txt](https://malbersanimations.gitbook.io/animal-controller/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://malbersanimations.gitbook.io/animal-controller/main-components/combo-manager.md).

# Combo Manager

## Overview

This component uses Modes Abilities Index in the Animal Controller to create combo sequences.&#x20;

<figure><img src="/files/onc1VRHnpXpKUEt5udsq" alt=""><figcaption></figcaption></figure>

## Requirements

It requires an Animal Controller component. It does not have to be in the same gameobject as the Animal script. I recommend setting this component in a Child GameObject

<figure><img src="/files/UeJbauQIf7kJblya2SgW" alt=""><figcaption></figcaption></figure>

## How it works

The combo manager uses Modes to play animations. It will check the right time for an Ability to play the next animation given a Branch value. The Branch value is the Input you give the character.

E.g. **Branch 0** is Left click; **Branch 1** is Right Click. You can have as many branches as you like.&#x20;

![First: Atk1 +Atk1+Atk1(0-0-0)                               Second: Atk1+Atk1+Atk2 (0-0-1)](/files/-MTgwLdUSmjDQ85Hg41E)

{% hint style="info" %}
To play a combo, call the method. **`ComboManager.Play(int Branch)`**
{% endhint %}

Connect the method to your Input Provider:

<figure><img src="/files/FdZJLgveztai9SJpIUYB" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}

## If you are using the [Weapon Manager](/animal-controller/main-components/weapon-manager.md), There is no need to use the Play() method. The [Weapon Manager](/animal-controller/main-components/weapon-manager.md) will do it automatically.

{% endhint %}

## Parameters

### Animal

Reference for the Animal Component

### Active Combo Index

Which is the current Active combo. This is used when you want to change combos if the character is unharmed, or if the character equips a weapon. The Active Combo is highlighted in yellow

![](/files/I8vPrxCsXyc4turTRqR7)

{% hint style="info" %}
If the Active Combo Index is set to -1, no combo will play. (The combo manager will be disabled
{% endhint %}

### Branch

This value holds the branching value for the combo sequences. For example: You can set the Branch Value 0 to the Mouse Left Click, and 1 for Mouse Right Click. Changing the Branch Value in the middle of a sequence allows to have different animation variations in a single Combo.&#x20;

### Disable on Sleep

If the Animal Controller is sleep, the combo manager will be disabled internally too.

## Combo List

Combos are groups of sequences that activate a new [**Mode** ](/animal-controller/main-components/manimal-controller/modes.md)**Ability** on the Animal using the activation time of the current/Required Mode Ability.&#x20;

<figure><img src="/files/3e3Wkjy6HBLVOSqlJY2y" alt=""><figcaption></figcaption></figure>

### Index

Index of the combos. Use it to set the current active Combo with the method: **`ComboManager.SetActiveCombo(int Index)`**. An example of this is when a new weapon is equipped. The active combo will change from Unarmed to Melee.

### Name

Name of the Combo. Use this value if you do not want to use the index value with the method: **`ComboManager.SetActiveCombo(string Index)`**

### Mode

The mode that will be used in the Combo.&#x20;

## Sequences

&#x20;Each sequence holds the values needed to activate the proper animation at the proper time.

<figure><img src="/files/4gdnFY4RLaZk2bJwSgc2" alt=""><figcaption></figcaption></figure>

### **Branch**

Helps activate different sequences with different inputs.

### **Required Ability**

&#x20;Used to Identify which is the current Playing Ability on the mode.

{% hint style="success" %}
&#x20;If is set to **Zero** then the Ability is a Started Combo Sequence

Is recommended that All Combo starters are set at the top of the list. They are color coded with <mark style="color:green;">**green**</mark>**.**
{% endhint %}

### **Play Ability**

&#x20;Used to Activate an Ability on the Mode if the Required Ability is within the Activation time

### **Activation Time**

Search on the Playing Ability Animation the range in a normalized time and if you execute the Activation Combo code within that range, then the next sequence will be activated.&#x20;

### **Finisher**

Used to identify if the current playing sequence is the Finisher Animation. This is color coded as **Cyan**.

All the sequences use a mode **Ability** index to identify which Animation can be activated:

![Steve Attack Mode and its Abilities Index. E.g. Right Punch Index is 1](/files/-MTh1VxDXGGrDSbd7dBo)

## Events

<figure><img src="/files/KYgRETsER0PEPkLJ0Hq5" alt=""><figcaption></figcaption></figure>

### On Sequence Play (Int)

Invoked when the sequence starts. the value given is (Mode ID\*1000 + Ability Value)

### On Combo Finished

Invoked when the combo played a finisher sequence

### On Combo Interrupted

Invoked when the combo played **did not** play a finisher sequence

## Functions and Methods

### `void Play(int branch)`

> Set the Branch value. and plays a combo

### `void SetActiveCombo(int Index)`

> Set the current active combo on the Manager

### `void SetBranch(int branch)`

> Set the Branch value.
