Exemple #1
0
        protected override void Update(GameTime gameTime)
        {
            currentGameState.Update(gameTime);

            lastKeyboardState = currentKeyboardState;
            currentKeyboardState = Keyboard.GetState();
            ParseInput(currentKeyboardState);

            if (!isPaused)
            {
                foreach (Camera cam in cameras)
                    cam.Update(gameTime);

                if (changingCamera)
                {
                    currentCamera.Update(gameTime);
                    (currentCamera as AnimationCam).SetUpAndRight(cameras[(int)currentCameraType].Up, cameras[(int)currentCameraType].Right);
                    if (Vector3.Distance(currentCamera.Position,cameras[(int)currentCameraType].Position)<30.0f || (currentCamera as AnimationCam).AnimatingDone)
                    {
                        currentCamera = cameras[(int)currentCameraType];
                        changingCamera = false;
                    }
                    else
                    {
                        (currentCamera as AnimationCam).From = currentCamera.View;
                        (currentCamera as AnimationCam).To = cameras[(int)currentCameraType].View;
                    }
                }

                base.Update(gameTime);
            }

            //this.Window.Title = vehicles[0].Position.ToString();
        }
Exemple #2
0
 private void ChangeCamera(CameraType type)
 {
     currentCameraType = type;
     currentCamera = new AnimationCam(currentCamera.View, cameras[(int)type].View, GraphicsDevice);
     changingCamera = true;
 }
Exemple #3
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            pausedTex = Content.Load<Texture2D>("paused");

            PrepareTrack();

            PrepareVehicles();

            PrepareEnvironment();

            LoadCameras();
            currentCamera = cameras[0];

            lastMouseState = Mouse.GetState();
            currentGameState = new MenuGS(this);
        }