Example #1
0
        public void Initialize(GraphicsDeviceManager graphics, VertexPositionNormalTexture[] vertices, int alturaMapa, Vector3 posicaoTank, Matrix worldTank, Matrix ViewTank, Tank tank)
        {
            this.tank = tank;

            this.alturaMapa = alturaMapa;
            this.vertices   = vertices;

            cameraAula    = new CameraAula(graphics);
            cameraSurface = new CameraSurfaceFollow(graphics, vertices, alturaMapa);
            cameraTank    = new CameraTank(graphics, vertices, alturaMapa, posicaoTank, worldTank, ViewTank);
        }
Example #2
0
        public void Initialize(GraphicsDeviceManager graphics, VertexPositionNormalTexture[] vertices, int alturaMapa, Vector3 posicaoTank, Matrix worldTank, Matrix ViewTank, Tank tank)
        {
            this.tank = tank;

            this.alturaMapa = alturaMapa;
            this.vertices = vertices;

            cameraAula = new CameraAula(graphics);
            cameraSurface = new CameraSurfaceFollow(graphics, vertices, alturaMapa);
            cameraTank = new CameraTank(graphics, vertices, alturaMapa, posicaoTank, worldTank, ViewTank);
        }
Example #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);
            //Criar e definir o resterizerState a utilizar para desenhar a geometria
            RasterizerState rasterizerState = new RasterizerState();

            //rasterizerState.CullMode = CullMode.None;
            //rasterizerState.FillMode = FillMode.WireFrame;
            rasterizerState.MultiSampleAntiAlias = true;
            GraphicsDevice.RasterizerState       = rasterizerState;
            // TODO: use this.Content to load your game content here


            //Camera.Initialize(GraphicsDevice);

            mapaAlturas = Content.Load <Texture2D>("mapaAlturas");
            textura     = Content.Load <Texture2D>("grass50x50");
            terreno     = new Terreno(GraphicsDevice, mapaAlturas, mapaAlturas, 1f, textura);
            //terreno2 = new Terreno2(GraphicsDevice, mapaAlturas, mapaAlturas, 1f, textura);
            VertexPositionNormalTexture[] vertices = terreno.getVertices();
            tank         = new Tank(GraphicsDevice, terreno.getVertices(), terreno.larguraMapa, new Vector3(10, 20, 10), true, Content);
            tankEnimigo  = new Tank(GraphicsDevice, terreno.getVertices(), terreno.larguraMapa, new Vector3(80, 20, 80), false, Content);
            tankEnimigo2 = new Tank(GraphicsDevice, terreno.getVertices(), terreno.larguraMapa, new Vector3(80, 20, 20), false, Content);
            tankEnimigo3 = new Tank(GraphicsDevice, terreno.getVertices(), terreno.larguraMapa, new Vector3(70, 20, 50), false, Content);
            listaTanques.Add(tank);
            listaTanques.Add(tankEnimigo);
            listaTanques.Add(tankEnimigo2);
            listaTanques.Add(tankEnimigo3);
            colisionManager = new ColisionManager(listaTanques);


            cameraSurfaceFollow = new CameraSurfaceFollow(graphics, vertices, mapaAlturas.Width);
            camera         = new CameraAula(graphics);
            cameraTank     = new CameraTank(graphics, vertices, mapaAlturas.Width, tank.getPosition(), tank.getWorldMAtrix(), tank.view);
            camera2        = new CameraVersao2();
            effect         = new BasicEffect(GraphicsDevice);
            mousePosition  = new Vector2(0, 0);
            IsMouseVisible = false;
            cameraAtiva    = CameraAtiva.free;

            //float aspectRatio = (float)GraphicsDevice.Viewport.Width / GraphicsDevice.Viewport.Height;

            //effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 0.1f, 1000.0f);
            tank.LoadContent(Content);
            tankEnimigo.LoadContent(Content);
            tankEnimigo2.LoadContent(Content);
            tankEnimigo3.LoadContent(Content);
            BulletManager.Initialize(tank, Content);
            IA.Initialize();
        }
Example #4
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);
            //Criar e definir o resterizerState a utilizar para desenhar a geometria
            RasterizerState rasterizerState = new RasterizerState();
            //rasterizerState.CullMode = CullMode.None;
            //rasterizerState.FillMode = FillMode.WireFrame;
            rasterizerState.MultiSampleAntiAlias = true;
            GraphicsDevice.RasterizerState = rasterizerState;
            // TODO: use this.Content to load your game content here

            //Camera.Initialize(GraphicsDevice);

            mapaAlturas = Content.Load<Texture2D>("mapaAlturas");
            textura = Content.Load<Texture2D>("grass50x50");
            terreno = new Terreno(GraphicsDevice, mapaAlturas, mapaAlturas, 1f, textura);
            //terreno2 = new Terreno2(GraphicsDevice, mapaAlturas, mapaAlturas, 1f, textura);
            VertexPositionNormalTexture[] vertices = terreno.getVertices();
            tank = new Tank(GraphicsDevice, terreno.getVertices(), terreno.larguraMapa,new Vector3(10,20,10), true,Content);
            tankEnimigo = new Tank(GraphicsDevice, terreno.getVertices(), terreno.larguraMapa,new Vector3(80,20,80) ,false,Content);
            tankEnimigo2 = new Tank(GraphicsDevice, terreno.getVertices(), terreno.larguraMapa, new Vector3(80, 20, 20), false, Content);
            tankEnimigo3 = new Tank(GraphicsDevice, terreno.getVertices(), terreno.larguraMapa, new Vector3(70, 20, 50), false, Content);
            listaTanques.Add(tank);
            listaTanques.Add(tankEnimigo);
            listaTanques.Add(tankEnimigo2);
            listaTanques.Add(tankEnimigo3);
            colisionManager = new ColisionManager(listaTanques);

            cameraSurfaceFollow = new CameraSurfaceFollow(graphics, vertices, mapaAlturas.Width);
            camera = new CameraAula(graphics);
            cameraTank = new CameraTank(graphics, vertices, mapaAlturas.Width, tank.getPosition(), tank.getWorldMAtrix(),tank.view);
            camera2 = new CameraVersao2();
            effect = new BasicEffect(GraphicsDevice);
            mousePosition = new Vector2(0, 0);
            IsMouseVisible = false;
            cameraAtiva = CameraAtiva.free;

            //float aspectRatio = (float)GraphicsDevice.Viewport.Width / GraphicsDevice.Viewport.Height;

            //effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 0.1f, 1000.0f);
            tank.LoadContent(Content);
            tankEnimigo.LoadContent(Content);
            tankEnimigo2.LoadContent(Content);
            tankEnimigo3.LoadContent(Content);
            BulletManager.Initialize(tank,Content);
            IA.Initialize();
        }