Building In Trigger

Description

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

Declaration

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

Parameters

NameDescription

vehicleIndex

The index of the vehicle that saw the building.

building

The collider of the building.

Set Method

 public static void SetBuildingInTrigger(BuildingInTrigger buildingInTriggerDelegate)

Example

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);
    }
}

Default delegate implementation can be found inside DefaultDelegates.cs

Last updated