예제 #1
0
        public Simulation(MainForm mainform, int id)
        {
            buildinglist = new List<Building>();
            crossinglist = new List<Crossing>();
            FileName = string.Format("Simulation {0}", id);
            Id = id;
            this.mainform = mainform;
            manualresetevent = new ManualResetEvent(false);
            roadlist = new List<Road>();
            simulationthread = new Thread(simulate);
            spawnlanelist = new List<RoadLane>();
            timewatch = new TimeWatch();
            unspawnlanelist = new List<RoadLane>();
            vehiclefactory = new VehicleFactory();
            vehiclelist = new List<Vehicle>();
            buggedmap = false;

            makemenus();
            makemap();
            calculateborderpoints();

            foreach (Road road in roadlist)
            {
                spawnlanelist.AddRange(road.GetSpawnLanes());
                unspawnlanelist.AddRange(road.GetUnSpawnLanes());
            }

            matrixchanged(null, new EventArgs());
            subscribeeventhandlers();
            resetsimulation();

            simulationthread.Start();
            mainform.ExtendedStatusStrip.UpdateStatus("Simulation loaded.");
        }
예제 #2
0
 public Simulation DeserializationRepopulation(MainForm mainform)
 {
     this.mainform = mainform;
     timewatch = new TimeWatch();
     font = new Font("Calibri", 2*ParameterPanel.Matrix.Elements[0]);
     manualresetevent = new ManualResetEvent(false);
     makemenus();
     calculateborderpoints();
     matrixchanged(null, new EventArgs());
     subscribeeventhandlers();
     resetsimulation();
     simulationthread = new Thread(simulate);
     simulationthread.Start();
     mainform.ExtendedStatusStrip.UpdateStatus("Simulation loaded.");
     return this;
 }