SetHazardLights

Description

Enable/disable hazard lights for a vehicle.

Declaration

public static void SetHazardLights(int vehicleIndex, bool activate)

Parameters

NameDescription

vehicleIndex

The index of the vehicle.

activate

true - means hazard lights are on.

Example

using Gley.TrafficSystem;
using UnityEngine;
public class Test : MonoBehaviour
{
    //a reference to vehicle pool and player assigned in inspector
    public VehiclePool vehiclePool;
    public Transform player;

    void Start()
    {
        API.Initialize(player, 20, vehiclePool);
    }

    public void TurnHazardLightsOn()
    {
        API.SetHazardLights(0, true);
    }

    public void TurnHazardLightsOff()
    {
        API.SetHazardLights(0, false);
    }
}

Last updated