示例#1
0
        public Simulation(SimulationSettings settings)
        {
            Instance      = this;
            this.settings = settings;

            // Random number generation.
            this.rand = new Random();

            // Create the environment.
            this.env = new Environment(30, 30, new Random(rand.Next()));

            // 'Warm up' the environment.
            for (int i = 0; i < WARMUP_TIME * 60; i++)
            {
                env.Update(1.0 / 6.0);
            }

            // Add a jumpman to the environment with some energy.
            this.env.AddObject(
                new Jumpman(99, new Random(rand.Next()))
                );

            // Add the camera to the environment.
            Camera cam = new Camera(Vector2.zero, 15, 15, Globals.viewport);

            this.env.AddObject(cam);

            // Create the minimap.
            this.minimap = new Minimap(env, cam, Globals.mapRect);

            this.helpMenuTex = new Texture(Globals.renderer, "sprites/helper_menu.png");

            // Create the environment tracker.
            envTracker = new EnvironmentTracker(env);

            // Create the environment grapher.
            envGrapher  = new EnvironmentGrapher(envTracker, GraphTypes.NutritionAndJumpmen);
            graphThread = new Thread(UpdateGraph);
            graphThread.Start();
        }
 /// <summary>
 /// Create a new environment grapher.
 /// </summary>
 public EnvironmentGrapher(EnvironmentTracker tracker, GraphTypes graphType)
 {
     this.tracker   = tracker;
     this.graphType = graphType;
 }