public void StartShowcase() { CarsOnSceneManager carsManager = CarsCollectionObject.GetComponent <CarsOnSceneManager>(); GameObject car = Instantiate(CarPrefab, CarsCollectionObject.transform); car.GetComponent <GameplayScript>().SetStartPosition(CarsCollectionObject.transform); GameObject AISpecimen = Instantiate(AISpecimanPrefab, PopulationManagerObject.transform); GameObject inputSource = Instantiate(AIInputSourcePrefab, InputSourcesCollectionObject.transform); AIInputSource AISource = inputSource.GetComponent <AIInputSource>(); AISource.BindWithAI(AISpecimen.GetComponent <SpecimenScript>()); car.GetComponent <OrdersReceiverScript>().SetInputSource(AISource); AISource.BindWithCar(car); carsManager.CarAdded(); carsManager.StartSimulation(0f, false); HidePanel(); }
public void StartSimulation() { //Plots.RestartedSimulation(process); CarsOnSceneManager carsManager = CarsCollectionObject.GetComponent <CarsOnSceneManager>(); for (int i = 0; i < NumberOfCarsPanel.NumberOfCars; i++) { GameObject car = Instantiate(CarPrefab, CarsCollectionObject.transform); car.GetComponent <GameplayScript>().SetStartPosition(CarsCollectionObject.transform); if (i != 0 || !HumanInputEnabled.isOn) { GameObject AISpecimen = Instantiate(AISpecimanPrefab, PopulationManagerObject.transform); GameObject inputSource = Instantiate(AIInputSourcePrefab, InputSourcesCollectionObject.transform); AIInputSource AISource = inputSource.GetComponent <AIInputSource>(); AISource.BindWithAI(AISpecimen.GetComponent <SpecimenScript>()); car.GetComponent <OrdersReceiverScript>().SetInputSource(AISource); AISource.BindWithCar(car); } else { GameObject inputSource = Instantiate(HumanInputSourcePrefab, InputSourcesCollectionObject.transform); HumanInputSourceScript human = inputSource.GetComponent <HumanInputSourceScript>(); car.GetComponent <OrdersReceiverScript>().SetInputSource(human); } } carsManager.CarAdded(); float mut, sel; carsManager.StartSimulation(0f); PassValuesToPopulationManager(out mut, out sel).StartSimulation(mut, sel, true); HidePanel(); }