Exemplo n.º 1
0
    private void OnRenderImage(RenderTexture src, RenderTexture dest)
    {
        if (!_tooLateToReduceGraphicsQuality && Time.time - _timeStarted >= 1.0f)
        {
            if (_sceneFPSCounter != null && _sceneFPSCounter.IsUnderFramerate(TARGET_FRAMERATE))
            {
                CancelCardTrails();
                _mainGameModtroller.RemoveCardShadows();
                MainMenuModtroller.ShouldDestroyShadowsOfNewCards = true;
                _mainGameModtroller.ReduceCardQuality();
                MainMenuModtroller.ShouldReduceQualityOfNewCards = true;
            }
            _collidersToEnableAfterQualityCheck.ForEach(c => c.enabled = true);
            _tooLateToReduceGraphicsQuality = true;
        }

        if (_renderCardTrails)
        {
            if (_framesToClearCardBuffer > 0)
            {
                RenderTexture.active = _cardFadeTexture;
                GL.Clear(true, true, new Color(0.0f, 0.0f, 0.0f, 0.0f));
                RenderTexture.active = _cardFadeSwapTexture;
                GL.Clear(true, true, new Color(0.0f, 0.0f, 0.0f, 0.0f));
                RenderTexture.active = null;
                --_framesToClearCardBuffer;
            }

            _cardFadeSwapTexture.DiscardContents();
            Graphics.Blit(_cardFadeTexture, _cardFadeSwapTexture);
            _cardFadeTexture.DiscardContents();
            Graphics.Blit(_cardFadeSwapTexture, _cardFadeTexture, _blitFadeAwayMaterial);
            _cardFadeSwapTexture.DiscardContents();

            Graphics.Blit(_cardTrailsCamera.targetTexture, _cardFadeTexture, _blitOverlayMaterial);
            Graphics.Blit(_cardFadeTexture, src, _blitOverlayMaterial);
        }
        Graphics.Blit(src, dest);
    }