Ejemplo n.º 1
0
    /// <summary>
    /// Create the vehicle with the path inputted.
    /// </summary>
    /// <param name="vehicle">The vehicle to create.</param>
    /// <param name="path">The path to set the vehicle on.</param>
    /// <returns>The created vehicle.</returns>
    public Rigidbody SpawnVehicle(Rigidbody vehicle, Path path)
    {
        Rigidbody spawnedVehicle = Instantiate(vehicle, path.nodes[0].position, path.nodes[0].rotation);

        TemporarilyHideVehicle(spawnedVehicle, timeOfStartInvisibility);
        VehicleEngine vehicleEngine = spawnedVehicle.GetComponent <VehicleEngine>();

        vehicleEngine.SetPath(path);
        currentVehicles.Add(spawnedVehicle, path);
        return(spawnedVehicle);
    }