Triggered every time a waypoint that has the Trigger Eventoption enabled is reached by a vehicle.
Name
Description
vehicleIndex
The index of the vehicle that reached the waypoint.
waypointIndex
The waypoint index that triggered the event.
data
The data set on that waypoint by Trigger Event option.
Example
usingGley.TrafficSystem;usingUnityEngine;publicclassTest:MonoBehaviour{ //a reference to vehicle pool and player assigned in inspectorpublicVehiclePool vehiclePool;publicTransform player;voidStart() {API.Initialize(player,20, vehiclePool);Events.onWaypointReached+= WaypointReached; } /// <summary> /// Triggered every time a waypoint with Trigger Event check mark on is reached /// </summary> /// <paramname="vehicleIndex">the vehicle index that reached the waypoint</param> /// <paramname="waypointIndex">the index of the waypoint</param> /// <paramname="data">the data from the settings window</param>privatevoidWaypointReached(int vehicleIndex,int waypointIndex,string data) {Debug.Log(vehicleIndex +" "+ waypointIndex +" "+ data); }privatevoidOnDestroy() {Events.onWaypointReached-= WaypointReached; }}