# Zones

## Overview

Zones are Triggers that Enable Logics on the Animal, like Jump, Actions, Deaths... etc. Once an animal Enters a Zone it can be activated via Input or Automatically.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FryXMho9YlZhbemBJrgFg%2Fimage.png?alt=media&#x26;token=21f2aa89-7019-4cc9-9b3c-4b30b76830c3" alt=""><figcaption></figcaption></figure>

## Requirements

* A zone requires any type of **collider** set as **Trigger.**

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M5DgBP3I-USn4u6Bzby%2F-M5DhN52jUD5JGFDfxpy%2Fimage.png?alt=media\&token=f62b029f-ba27-4cb7-8c74-400042c21794)

* The Layer set on the GameObject must be different from the Layers set on the [**Ground Layer**](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/general#ground-layer) in the Animal Controller. Usually is set as **Ignore Layer**

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M5DgBP3I-USn4u6Bzby%2F-M5DhZAEILUPebrxvpqy%2Fimage.png?alt=media\&token=27e74b49-1350-4bb2-bf2c-90620aa9c0b1)

{% hint style="danger" %}

### The Animal needs to have any type of collider and a rigid body to interact with the zone

{% endhint %}

## Properties

### Automatic

As soon as the animal enters the zone it will activate the zone logic. If set to false you need to manually call: Zone.Activate()

### Disable After Used

Disables the zone after it's used 1 time.

### Limit

How many characters can use this zone at the same time. If set to a negative value (-1) then it has no limit.

### Trigger

As above, which collider is the trigger for the zone to activate

### Layer

Which layer should be used to detect the animal

### Zone Type

A zone can modify a [**Mode**](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/modes), Force, [**State**](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/states)**,** or [**Stance**](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/stances) on an animal, depending the Action set in the Zone.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F3Whq96V1CG6UQIKExlv2%2Fimage.png?alt=media&#x26;token=e04fa971-a626-4d15-9492-713cb72abd73" alt=""><figcaption></figcaption></figure>

## **Type: Mode**

### **Mode ID**

Which Mode ID should activate

### **Ability Index**

Which ability should activate. See the [**Modes**](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/modes#abilities) documentation for more information

{% hint style="info" %}
When the [**Mode** ](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/modes)is Set to Action, the **Ability Index** Parameter it will automatically change to **Action ID** to help you better which [**Action Index**](https://malbersanimations.gitbook.io/animal-controller/scriptable-architecture/scriptables/scriptable-ids#actions) to play on the Animal
{% endhint %}

### **Status**

How should the Mode be played?&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F6sbmSU7OHPVeKpTUrAJi%2Fimage.png?alt=media&#x26;token=fd6a545b-43ef-4b33-a682-fa2c027032aa" alt=""><figcaption></figcaption></figure>

### Mode Power

Value assigned to the mode float value when using the zone

### Force Mode

Plays a mode no matter if a mode is already playing

## **Type: State**

When the Zone is set to [**State**](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/states)**,** The animal will automatically make an **State Action**  if it enters the Zone Trigge&#x72;**.**&#x20;

### **State ID**

ID of the State to modify e.g. Fly, Death etc.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fnm9uKc26i0aQUGmjudAz%2Fimage.png?alt=media&#x26;token=52fddc8e-197c-458a-94ed-ca84444c2dcc" alt=""><figcaption></figcaption></figure>

### On Enter/Exit

The zone can have different enter and exit actions:<br>

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FnuFdGVmonWLvhePIR4Zd%2Fimage.png?alt=media&#x26;token=0c8bac50-e415-4742-809e-b7af92132606" alt=""><figcaption></figcaption></figure>

### Activate

Activate a State on an Animal.

![Horse dies (Activates Death) when it touches the Death Zone Trigger](https://lh6.googleusercontent.com/t6CdKaeHo60lasyeFPHCXDgDqVAHk_okpUn_H60u0XMF4wwP956qBSHRyqn0FiBYsICjIlbhQanh5cTsGdB8LX0I411LAFrWWPv4WDmZAbGTd-MkqRUja9iM2pmZB5DdfrZA_Prj)

### Allow Exit

Some States cannot exit on their on because some conditions may need to be completed. Calling the Method: **State.AllowExit()** on the Animal permits the state to exit and other **states** with lower priority to try to activate themselves.&#x20;

For Example:  A character is Flying; then enters A **Fly State Zone** with **Allow Exit** set, this will allow other States like **Fall** to be activated since the **Fly** State is allowing lower priority states to be active.

![The Dragon Exit Fly when entering the Fly Zone with (AllowExit), allowing Fall State to be activated.](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M5DpwQFEEavm9jNz2nE%2F-M5DssrBidNgGCxfvLj0%2FB1NmLqumLx.gif?alt=media\&token=8e696640-d640-48e2-9f31-39375357bd71)

### Force Activate

Some States **cannot** be activated on their on, because it may require some conditions to be completed. This action forces any state to be Active.&#x20;

E.g.: The Swim State can only be Activated if the animal touches the water. but it can be forced using this action.

### Disable

Disable a State on an Animal.&#x20;

E.g.: you can have a *Jump State Zone* to Disable the **Jump State** when a character enters a room.

### Enable&#x20;

If a State on an animal  is Disabled, it will enable it back.

E.g.: you can have a *Jump State Zone* to Enable the **Jump State** when a character exits a room.

### Set Exit Status

Sets the Exit status on the Animator to be true

## Type: Stance

When the Zone is set to [**Stance**](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/stances), The animal will automatically make an **Stance Action**  if it enters the Zone Trigge&#x72;**.**&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FkaZ9OK1Pmnv6wiYkmPrF%2Fimage.png?alt=media&#x26;token=54e2009f-f1ae-42e7-999a-2b8d4704a6f6" alt=""><figcaption></figcaption></figure>

### **Stance ID**

ID of the Stance to modify.

### On Enter/On Exit

The zone can have different enter and exit actions.

### Activate

On **Entering** the Trigger Zone: the [**Current Stance**](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/stances#current-stance) on the Animal will be equal to the Zone [**Stance ID**](#stance-id).

### Exit

On **Exiting** the Trigger Zone: the [**Current Stance**](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/stances#current-stance) on the Animal will be equal to the Zone [**Stance ID**](#stance-id).

### Set Default

Set's the default stance to the stance specified in the StanceID

## Type: Force

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FBwtMmJ2l5JpSzyVFElwx%2Fimage.png?alt=media&#x26;token=3e315d3d-7b0f-4a61-a704-062d3067c9d7" alt=""><figcaption></figcaption></figure>

### Force

Amount of Force that gets applied to the animal

### Enter Acceleration

Acceleration to apply the force when the animal enters the zone

### Exit Drag

Set a value for the drag applied when the animal exits the zone

### Limit Force

Set a limit for the total amount of force to apply

### Air Control

Can the animal be controlled whilst in the air?

### Grounded

Changes if the animal is grounded when entering the force zone

## Other Parameters

### Weight

Probability to activate the zone when entering the zone 0 - 1. \
0 = 0%. 0.5 = 50%, 1 = 100%.

### Angle

Limit the activation of the zone from certain angles only

### Reset on Active

Removes the stored Animal on the zone when the zone is activated, resetting it to it's default state

### Tags

Set this parameter only if you want the zone to activate with certain gameobjects with tags.

### Bone Only

Activate when a bone enters the zone. The bone needs it's own collider.

### Bone Name

Name of the bone to check if Bone Only is true.

## Events

### On Animal Enter Zone

Invoked when the Animal Enters the Zone Trigger

### On Animal Exit Zone

Invoked when the Animal Exits the Zone Trigger

### On Zone Active

Invoked when the Animal Activates the Zone

### On Zone Failed

Invoked when the zone fails to activate for whatever reason e.g. the wrong animal walks into it
