/* Call a new car.. */ private void callNewCar() { // If there are not cars availables. if (vehiculosTemporales.Count <= 0) { return; } // Get the first car. DistribucionVehiculosGeneticos.Vehiculo tempVehiculo = vehiculosTemporales[0]; // If the car is not going to be assigned. if (vehiculosTemporales[0].GetLineaAsignada() != null) { GameObject newCar = salaObject.getCarById(tempVehiculo.GetId()); // Get the respective car of the waitRoom. if (newCar) { newCar.transform.position = new Vector3(transform.position.x, transform.position.y, newCar.transform.position.z); GameObject lineObject = getLine(tempVehiculo.GetLineaAsignada().GetId()); // Get the line of the car. lines line = lineObject.GetComponent <lines>(); // Call the script of the line. newCar.GetComponent <vehicle>().setActualLine(line); // Add to the car, the state of the actual line. line.addElement(newCar); // Add the new car to the line. vehiculosTemporales.Remove(tempVehiculo); } } else { vehiculosTemporales.Remove(tempVehiculo); // Remove the car from the possibles ... and call other. callNewCar(); } }
public Vehiculo(Vehiculo v) { this.id = v.GetId(); this.tipo = v.GetTipo(); this.tiempo = v.GetTiempo(); this.probAsignado = v.GetProbAsignado(); this.lineaAsignada = v.GetLineaAsignada(); }