Ejemplo n.º 1
0
        public static MapHandler GetInstance(Vector2 Bounds)
        {
            if (Instance == null)
            {
                Instance =new MapHandler(Bounds);
            }

            return Instance;
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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);

            // 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;
        }