# 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 %}
