ClearTrafficOnArea

Description

Removes all the vehicles from a given area. The area is circular defined by the center and radius.

Declaration

public static void ClearTrafficOnArea(Vector3 center, float radius)

Parameters

NameDescription

center

The center of the circle to remove vehicles from.

radius

The radius in meters of the circle to remove vehicles from.

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 ClearTraffic()
    {
        //clear all the traffic 20m around the player 
        API.ClearTrafficOnArea(GameObject.Find("Player").transform.position, 20);
    }
}

Last updated