示例#1
0
 public static CarC create(List <KeyFrameC> carKFLists, List <KeyFrameC> sCarKFLists, List <mapPoint> carMPLists, List <mapPoint> sCarMPLists)
 {
     if (carItemUIFab == null)
     {
         carItemUIFab = Resources.Load("carItemUI") as GameObject;
         carListUI    = GameObject.Find("Canvas/Panel/CarList/ScrollView/List");
         carList      = new List <CarC>();
         GameObject obj = GameObject.Find("Main Camera") as GameObject;
         cameraCont = obj.GetComponents <CameraMovement> () [0];
     }
     if (carKFLists.Count > 0)
     {
         GameObject clone = Object.Instantiate(carItemUIFab,
                                               Vector3.zero,
                                               Quaternion.identity
                                               ) as GameObject;
         clone.transform.Find("Text").GetComponents <Text> () [0].text =
             "Car " + curCarId;
         CarC itemCar = new CarC();
         clone.GetComponents <Button> () [0].onClick.AddListener(
             () => itemCar.onClickCarUI());
         itemCar.btn = clone.transform;
         itemCar.id  = curCarId;
         curCarId    = curCarId + 1;
         clone.transform.SetParent(carListUI.transform);
         KFListObj carKF = KFListObj.create(carKFLists, 0);
         itemCar.keyFrameObj = carKF;
         carList.Add(itemCar);
         return(itemCar);
     }
     return(null);
 }
        private void initializeSimulationInstances()
        {
            Vehicle carA = new CarA(seedGenerator);
            Vehicle carB = new CarB(seedGenerator);
            Vehicle carC = new CarC(seedGenerator);
            Vehicle carD = new CarD(seedGenerator);
            Vehicle carE = new CarE(seedGenerator);

            simulationA = new SimulationVariantA(maxTime, replications, backgroundWorker1, seedGenerator);
            simulationA.initCars(carA, carB, carC, carD);
            Event initialEventA = new EventVehiclesInit(simulationA, 0, simulationA.getCarsInitial());

            simulationA.init = initialEventA;

            simulationB = new SimulationVariantB(maxTime, replications, backgroundWorker1, seedGenerator);
            simulationB.initCars(carA, carC, carE);
            Event initialEventB = new EventVehiclesInit(simulationB, 0, simulationB.getCarsInitial());

            simulationB.init = initialEventB;

            simulationC = new SimulationVariantC(maxTime, replications, backgroundWorker1, seedGenerator);
            simulationC.initCars(carB, carC, carD);
            Event initialEventC = new EventVehiclesInit(simulationC, 0, simulationC.getCarsInitial());

            simulationC.init = initialEventC;

            if (variant == 1)
            {
                simulationA.isVisualized = isChecked;
            }
            else if (variant == 2)
            {
                simulationB.isVisualized = isChecked;
            }
            else if (variant == 3)
            {
                simulationC.isVisualized = isChecked;
            }
        }