GetVehicleState

Description

Get the current DriveActions of the specified vehicle.

Declaration

public static DriveActions GetVehicleState(int vehicleIndex)

Parameters

NameDescription

vehicleIndex

The index of the vehicle.

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 GetVehicleState()
    {
        Debug.Log($"Vehicle with index 0 is in state: {API.GetVehicleState(0)}");
    }
}

Last updated