コード例 #1
0
        public Roadmap(Game1 game,GraphicsDeviceManager graphicDevice,SpriteBatch spriteBatch,Texture2D texture,Scenario scenario, int numberOfSample, int depth, float agentTextureWidth, float agentTextureHeight)
            : base(game)
        {
            this.game = game;
            this.graphicDevice = graphicDevice;
            this.spriteBatch = spriteBatch;
            this.texture = texture;
            this.scenario = scenario;
            this.numberOfSample = numberOfSample;
            this.depth = depth;
            this.agentTextureWidth = agentTextureWidth;
            this.agentTextureHeight = agentTextureHeight;
            displayWidth = graphicDevice.PreferredBackBufferWidth;
            displayHeight = graphicDevice.PreferredBackBufferHeight;

            fillSampleListRandom(samplingMethod);
            if(depth != 0)
                connectConfiguration();
        }
コード例 #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("myFont");
            t = Content.Load<Texture2D>("Square");
            obstacleTexture = Content.Load<Texture2D>("randomPosition");
            scenario = new Scenario(this, spriteBatch, t, "DuzDarBogaz");
            roadmap = new Roadmap(this, graphics, spriteBatch, t, scenario, 100, 5, 20, 60);
            dijsktra = new Dijkstra(roadmap);
            agent = new Agent(this, spriteBatch, t, 0, 0, 20, 60, 0.0F, Color.Yellow,dijsktra,"deneme");

            roadmap.Enabled = true;
            agent.Enabled = true;
            this.Components.Add(agent);
            this.Components.Add(roadmap);

            // TODO: use this.Content to load your game content here
        }