//----------------------//------------------------//

        public override void initialize()
        {
            addRenderer(new DefaultRenderer());
            clearColor = new Color(58, 61, 101);
            createMenu();

            _bloomPostProcessor       = addPostProcessor(new BloomPostProcessor(2));
            _pixelGlitchPostProcessor = addPostProcessor(new PixelGlitchPostProcessor(1));
            _pixelGlitchPostProcessor.horizontalOffset = 0;
            _blurAmount = 1;

            _glitchCooldown = 3.0f;

            MediaPlayer.Play(AudioManager.mystOnTheMoor);
        }
            static IEnumerator DoGlitchEffect(PixelGlitchPostProcessor glitch)
            {
                while (true)
                {
                    var next = Nez.Random.Range(1f, 3f);
                    yield return(Coroutine.WaitForSeconds(next));

                    var duration = Nez.Random.Range(0.1f, 0.5f);
                    while (duration > 0)
                    {
                        duration -= Time.DeltaTime;
                        glitch.HorizontalOffset = Nez.Random.Range(0.2f, 1f) * ((Nez.Random.NextInt(2) * 2) - 1);
                        yield return(null);
                    }
                    glitch.HorizontalOffset = 0;
                }
            }
示例#3
0
        private void SetupPostProcess()
        {
            _scanLines = content.loadNezEffect <ScanlinesEffect>();

            _scanLines.attenuation     = 0.0f;
            addPostProcessor(_vignette = new VignettePostProcessor(2));
            addPostProcessor(new PostProcessor(2, _scanLines));
            addPostProcessor(_pixelGlitch = new PixelGlitchPostProcessor(1));
            addPostProcessor(_letterbox   = new CinematicLetterboxPostProcessor(2));

            _bloom = new BloomPostProcessor(1);
            addPostProcessor(_bloom);
            _bloom.settings = _bloomSettingsNone;
            // removePostProcessor(_bloom);

            _pixelGlitch.horizontalOffset = 0.0f;
            _pixelGlitch.verticalSize     = 2f;
            _scanLines.linesFactor        = 500f;
            _vignette.power  = 0.8f;
            _vignette.radius = 1.0f;

            _letterbox.letterboxSize = 0.0f;
        }