private void RespawnWithPrefab() { VehicleFactory.Params param = new VehicleFactory.Params(m_waypoints [m_currWaypointIndex].position, m_waypoints [m_currWaypointIndex].rotation); VehicleController controller = m_factory.Create(param); controller.SetWaypoint(m_currWaypointIndex); Destroy(); }
/// <summary> /// Spawns a vehicle on the tracks first waypoint. /// </summary> /// <returns>The vehicles gameobject.</returns> public GameObject SpawnVehicleAtStart() { List <OrientedPoint> waypoints = m_splineManager.GetWaypoints(); VehicleFactory.Params param = new VehicleFactory.Params(waypoints [0].position, waypoints [0].rotation); VehicleController controller = m_vehicleFactory.Create(param); controller.SetWaypoint(0); return(controller.gameObject); }