예제 #1
0
        public void UpdateCameraPositionTankFollow(TankClass tanque, KeyboardState keyboard)
        {
            if (keyboard.IsKeyDown(Keys.W))
            {
                posicao   = tanque.PositionTank;
                posicao.X = posicao.X + offSetTank;
                posicao.Y = posicao.Y + offSetChao;
                posicao.Z = posicao.Z + offSetTank;
                alturaCam = tanque.PositionTank.Y + offSetChao;
            }
            if (keyboard.IsKeyDown(Keys.A))
            {
                posicao   = tanque.PositionTank;
                posicao.X = posicao.X + offSetTank;
                posicao.Y = posicao.Y + offSetChao;
                posicao.Z = posicao.Z + offSetTank;
                alturaCam = tanque.PositionTank.Y + offSetChao;
            }

            if (keyboard.IsKeyDown(Keys.A))
            {
                speed = tanque.DirectionTank;
            }
            if (keyboard.IsKeyDown(Keys.D))
            {
                speed = tanque.DirectionTank;
            }

            view = Matrix.CreateLookAt(posicao, speed, Vector3.Up);
        }
예제 #2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            terreno = new ClsBattlefield(GraphicsDevice, Content);
            camera  = new Camera(GraphicsDevice);
            tanque  = new TankClass(GraphicsDevice, Content, terreno);
        }