> For the complete documentation index, see [llms.txt](https://gley.gitbook.io/mobile-traffic-system/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gley.gitbook.io/mobile-traffic-system/delegates/building-in-trigger.md).

# Building In Trigger

## Description

Controls how the traffic vehicle reacts when a building is in the trigger.

## Declaration

```csharp
public delegate void BuildingInTrigger(int vehicleIndex, Collider building);
```

## Parameters

<table><thead><tr><th width="203">Name</th><th>Description</th></tr></thead><tbody><tr><td><strong>vehicleIndex</strong></td><td>The index of the vehicle that saw the building.</td></tr><tr><td><strong>building</strong></td><td>The collider of the building.</td></tr></tbody></table>

## Set Method

```csharp
 public static void SetBuildingInTrigger(BuildingInTrigger buildingInTriggerDelegate)
```

## Example

```csharp
using Gley.TrafficSystem;
using UnityEngine;

public class Test : MonoBehaviour
{
    private void Start()
    {
        Delegates.SetBuildingInTrigger(MyBuildingBehaviour);
    }

    public static void MyBuildingBehaviour(int vehicleIndex, Collider player)
    {
        //do avoid maneuvers
        API.AddDrivingAction(vehicleIndex, DriveActions.AvoidReverse, false);
    }
}
```

{% hint style="info" %}
Default delegate implementation can be found inside **DefaultDelegates.cs**
{% endhint %}
