示例#1
0
        protected override void LoadContent()
        {
            Vector2 Bounds;
            Bounds.X = GraphicsDevice.PresentationParameters.BackBufferWidth;
            Bounds.Y = GraphicsDevice.PresentationParameters.BackBufferHeight;

            PracticeCar = Car.GetInstance(Bounds);

            PracticeCar.Load(Content, "car");

            PracticeCar.ScaleFactor = 14;

            Map = MapHandler.GetInstance(Bounds);
            Map.LoadMap(Content);
            Map.Update();
            base.LoadContent();
        }
示例#2
0
文件: Agent.cs 项目: fahadm/EVHDM
        public GameAgent(Car mycar,NavigationSystem[] navSys)
        {
            Factors = new SortedDictionary<string, float>();
            MyCar = mycar;
            MyNavSystems = navSys;
            NavSystemFollowed = 0;
            UpdateTracker = MyNavSystems[NavSystemFollowed].UpdateNo;
            RNG = new Random();

            LastUpdate = new TimeSpan();
            LoadFactors("Agent.ini");

            A = new Agent(0.01, 0.50, 0.50, 0.25, 0.1, 0.50, Factors[RateOfExploration], "A1.xls", true);
            E = new EXPERIENCE[3];

            //E.Add(new EXPERIENCE());
            //E.Add(new EXPERIENCE());
            //E.Add(new EXPERIENCE());
            LastDistance = double.PositiveInfinity;
        }
示例#3
0
文件: Car.cs 项目: fahadm/EVHDM
 public static Car GetInstance(Vector2 screenSize)
 {
     if (Instance == null)
     {
         Instance= new Car(screenSize);
     }
     return Instance;
 }
示例#4
0
文件: mainClass.cs 项目: fahadm/EVHDM
        /// <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);

            // save the screen size in the bounds vector
            Bounds.X = GraphicsDevice.PresentationParameters.BackBufferWidth;
            Bounds.Y = GraphicsDevice.PresentationParameters.BackBufferHeight;

            //Loading Car
            MyCar = Car.GetInstance(Bounds);
            MyCar.ScaleFactor = ScaleFactor;
            MyCar.Load(Content, "car");

            //LoadMap
            Map = MapHandler.GetInstance(Bounds);
            Map.LoadMap(Content);

            //Loading Hospital Image
            Hospital = Content.Load<Texture2D>("Hospital");

            //Loading font
            Fonts.Myfont = Content.Load<SpriteFont>("Mono");
            this.Myfont = Fonts.Myfont;

            //Loading Sidebar
            navBar = new NavigationBar(GraphicsDevice, Bounds);
            navBar.Font = Myfont;

            //Setting the top left point of the car
            Point = new Vector2((int)(Bounds.X / 2 - MyCar.Length.X / 2), (int)(Bounds.Y / 2 - MyCar.Length.Y / 2));
            //Setting the center of the car
            Pivot = new Vector2(Bounds.X / 2, Bounds.Y / 2);

            //Memory image, used to save the screen data
            CurrentFrame = new RenderTarget2D(GraphicsDevice, (int)Bounds.X, (int)Bounds.Y, false, SurfaceFormat.Color, DepthFormat.None);

            //Navigation Systems

            MyNavSystems = new NavigationSystem[3];

            for (int i = 0; i < MyNavSystems.Length; i++)
            {
                MyNavSystems[i] = new NavigationSystem(this);
                MyNavSystems[i].timePoint= Helpers.GetTimeListfor(i);
                MyNavSystems[i].Probabilities= Helpers.GetProbabilityListfor(i);
            }
            MyNavSystems[0].Name = "Apple Navigation";
            MyNavSystems[1].Name = "Google Navigation";
            MyNavSystems[2].Name = "Tom Tom navigation";

                 MyNavSystems[0].Position= new Rectangle((int)(3 * Bounds.X / 4), 0, (int)Bounds.X / 4, (int)Bounds.Y / 3 - 3);

                 MyNavSystems[1].Position = new Rectangle((int)(3 * Bounds.X / 4), (int)(Bounds.Y / 3), (int)Bounds.X / 4, (int)Bounds.Y / 3 - 3);

                 MyNavSystems[2].Position = new Rectangle((int)(3 * Bounds.X / 4), (int)(2 * Bounds.Y / 3), (int)Bounds.X / 4, (int)Bounds.Y / 3 - 3); ;
            //setting line colors
            MyNavSystems[0].LineColor = new Color(255,0,0,230);
                MyNavSystems[1].LineColor = new Color(0,255,0,230);
                    MyNavSystems[2].LineColor = new Color(0,0,255,230);

                    //allocated the Nav systems screen
                 for (int i = 0; i < MyNavSystems.Length; i++)
                 {
                     MyNavSystems[i].PathSource = (NavTarget[i]=new RenderTarget2D(GraphicsDevice, (int)Bounds.X, (int)Bounds.Y));
                 }

                 MapScreen = new Texture2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
                 for (int i = 0; i < MyNavSystems.Length; i++)
                 {
                     MyNavSystems[i].CurrentTexture = MapScreen;
                 }
                 Line.Load(Content);

            ////////////////////////Testing Code This  can blow up
               //      GameAgent MyAgent = new GameAgent(MyCar, MyNavSystems);
               //  MyCar.KeyHandler = MyAgent.Act;
                 MyCar.carPos = CameraPos;
        }