Пример #1
0
        public void BoundCameraOffsetAndZoom(HackGameBoard board)
        {
            if (cameraOffset.X > 0.0f)
            {
                cameraOffset.X = 0.0f;
            }
            if (cameraOffset.Y > 0.0f)
            {
                cameraOffset.Y = 0.0f;
            }

            Vector2 boardmax = board.GetMaxCameraOffsetBottomRight(cameraZoom, board.GetGame().GraphicsDevice);

            if (cameraOffset.X < boardmax.X)
            {
                cameraOffset.X = boardmax.X;
            }

            if (cameraOffset.Y < boardmax.Y)
            {
                cameraOffset.Y = boardmax.Y;
            }

            float minZoom = board.GetMinZoom(board.GetGame().GraphicsDevice);

            if (cameraZoom < minZoom)
            {
                cameraZoom = minZoom;
            }
            if (cameraZoom > 1.5f)
            {
                cameraZoom = 1.5f;
            }
        }