Exemple #1
0
        public override void Render()
        {
            title?.Render();

            if (subtitleEase > 0f)
            {
                Vector2 position = new Vector2(Width / 2f, Height / 2f + 80f);
                float   x        = 1f + Ease.BigBackIn(1f - subtitleEase) * 2f;
                float   y        = 0.25f + Ease.BigBackIn(subtitleEase) * 0.75f;
                ActiveFont.Draw(Presentation.GetCleanDialog("PAGE1_SUBTITLE"), position, new Vector2(0.5f, 0.5f), new Vector2(x, y), Color.Black * 0.8f);
            }
        }
        private IEnumerator BirdRoutine(float delay)
        {
            yield return(delay);

            Level.Add(bird = new BirdNPC(Vector2.Zero, BirdNPC.Modes.None));
            bird.Sprite.Play("flyupIdle");
            Vector2 center    = new Vector2(320f, 180f) / 2f;
            Vector2 topCenter = new Vector2(center.X, 0.0f);
            Vector2 botCenter = new Vector2(center.X, 180f);
            Vector2 from1     = botCenter + new Vector2(40f, 40f);
            Vector2 to1       = center + new Vector2(-32f, -24f);

            for (var t = 0.0f; t < 1.0; t += Engine.DeltaTime / 4f)
            {
                birdScreenPosition = from1 + (to1 - from1) * Ease.BackOut(t);
                yield return(null);
            }

            bird.Sprite.Play("flyupRoll");
            for (var t = 0.0f; t < 1.0; t += Engine.DeltaTime / 2f)
            {
                birdScreenPosition = to1 + new Vector2(64f, 0.0f) * Ease.CubeInOut(t);
                yield return(null);
            }

            Vector2 from2      = birdScreenPosition;
            Vector2 to2        = topCenter + new Vector2(-40f, -100f);
            var     playedAnim = false;

            for (var t = 0.0f; t < 1.0; t += Engine.DeltaTime / 4f)
            {
                if (t >= 0.349999994039536 && !playedAnim)
                {
                    bird.Sprite.Play("flyupRoll");
                    playedAnim = true;
                }

                birdScreenPosition    = from2 + (to2 - from2) * Ease.BigBackIn(t);
                birdScreenPosition.X += t * 32f;
                yield return(null);
            }

            bird.RemoveSelf();
            bird = null;
        }
        private IEnumerator Cutscene()
        {
            Engine.TimeRate = 1f;
            boost.Active    = false;
            yield return(null);

            yield return(0.152f);

            cameraOffset = new Vector2(0.0f, -20f);
            boost.Active = true;
            player.EnforceLevelBounds = false;
            yield return(null);

            BlackholeBG blackhole = Level.Background.Get <BlackholeBG>();

            if (blackhole != null)
            {
                blackhole.Direction = -2.5f;
                blackhole.SnapStrength(Level, BlackholeBG.Strengths.High);
                blackhole.CenterOffset.Y = 100f;
                blackhole.OffsetOffset.Y = -50f;
                blackhole = null;
            }

            Add(new Coroutine(WaveCamera()));
            Add(new Coroutine(BirdRoutine(0.8f)));
            Level.Add(streaks = new AscendManager.Streaks(null));
            for (var p = 0.0f; p < 1.0; p += Engine.DeltaTime / 12f)
            {
                fadeToWhite   = p;
                streaks.Alpha = p;
                foreach (Parallax parallax in Level.Foreground.GetEach <Parallax>("blackhole"))
                {
                    Parallax fg = parallax;
                    fg.FadeAlphaMultiplier = 1f - p;
                }

                yield return(null);
            }

            while (bird != null)
            {
                yield return(null);
            }

            FadeWipe wipe = new FadeWipe(Level, false)
            {
                Duration = 4f
            };

            var from = cameraOffset.Y;
            var to   = 180;

            for (var p = 0.0f; p < 1.0; p += Engine.DeltaTime / 2f)
            {
                cameraOffset.Y = from + (to - from) * Ease.BigBackIn(p);
                yield return(null);
            }

            while (wipe.Percent < 1.0)
            {
                yield return(null);
            }

            EndCutscene(Level);
        }