Dynamic Obstacle In Trigger

Description

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

Declaration

 public delegate void DynamicObstacleInTrigger(int vehicleIndex, Collider obstacle);

Parameters

NameDescription

vehicleIndex

The index of the vehicle that saw the obstacle.

obstacle

The collider of the obstacle.

Set Method

public static void SetDynamicObstacleInTrigger(DynamicObstacleInTrigger dynamicObstacleInTriggerDelegate)

Example

using Gley.TrafficSystem;
using UnityEngine;

public class Test : MonoBehaviour
{
    private void Start()
    {
        Delegates.SetDynamicObstacleInTrigger(MyObstacleBehaviour);
    }

    public static void MyObstacleBehaviour(int vehicleIndex, Collider player)
    {
        //stop and wait
        API.AddDrivingAction(vehicleIndex, DriveActions.StopInDistance, false);
    }
}

Default delegate implementation can be found inside DefaultDelegates.cs

Last updated