Player In Trigger

Description

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

Declaration

public delegate void PlayerInTrigger(int vehicleIndex, Collider player);

Parameters

NameDescription

vehicleIndex

The index of the vehicle that saw the player.

player

The collider of the player.

Set Method

public static void SetPlayerInTrigger(PlayerInTrigger playerInTriggerDelegate)

Example

using Gley.TrafficSystem;
using UnityEngine;

public class Test : MonoBehaviour
{
    private void Start()
    {
        Delegates.SetPlayerInTrigger(MyPlayerInTriggerBehaviour);
    }

    public static void MyPlayerInTriggerBehaviour(int vehicleIndex, Collider player)
    {
        //if the player is seen, the speed is adapted to the speed of the player.
        API.AddDrivingAction(vehicleIndex, DriveActions.Follow, false);
    }
}

Default delegate implementation can be found inside DefaultDelegates.cs

Last updated