Esempio n. 1
0
        private IEnumerator DoFlingRoutine(Player player) {
            Level level = Scene as Level;
            Vector2 camera = level.Camera.Position;
            Vector2 zoom = player.Position - camera;
            zoom.X = Calc.Clamp(zoom.X, 145f, 215f);
            zoom.Y = Calc.Clamp(zoom.Y, 85f, 95f);
            Add(new Coroutine(level.ZoomTo(zoom, 1.1f, 0.2f)));
            Engine.TimeRate = 0.8f;
            Input.Rumble(RumbleStrength.Light, RumbleLength.Medium);
            while (flingSpeed != Vector2.Zero) {
                yield return null;
            }

            sprite.Play("throw");
            // sprite.Scale.X = 1f;
            sprite.Scale.X = -1f;
            flingSpeed = new Vector2(-140f, 140f);
            flingTargetSpeed = Vector2.Zero;
            flingAccel = 1400f;
            yield return 0.1f;
            Celeste.Freeze(0.05f);
            flingTargetSpeed = FlingSpeed;
            flingAccel = 6000f;
            yield return 0.1f;
            Input.Rumble(RumbleStrength.Strong, RumbleLength.Medium);
            Engine.TimeRate = 1f;
            level.Shake();
            Add(new Coroutine(level.ZoomBack(0.1f)));
            player.FinishFlingBird();
            flingTargetSpeed = Vector2.Zero;
            flingAccel = 4000f;
            yield return 0.3f;
            Add(new Coroutine(MoveRoutine()));
        }
Esempio n. 2
0
        private IEnumerator RefillRoutine(Player player)
        {
            Celeste.Freeze(0.05f);

            yield return(null);

            (Scene as Level).Shake();

            sprite.Visible = (flash.Visible = false);

            if (!oneUse)
            {
                outline.Visible = true;
            }
            Depth = 8999;

            yield return(0.05f);

            float angle = player.Speed.Angle();

            SlashFx.Burst(Position, angle);

            if (oneUse)
            {
                RemoveSelf();
            }
        }
Esempio n. 3
0
        public void Collect(Player player, Level level)
        {
            Collected    = true;
            Collidable   = false;
            Depth        = Depths.NPCs;
            sprite.Color = XNAColor.White;
            shaker.On    = true;

            bool allCollected = true;

            foreach (HeartGemShard piece in heartData.Get <List <HeartGemShard> >(HeartGem_HeartGemPieces))
            {
                if (!piece.Collected)
                {
                    allCollected = false;
                }
            }

            collectSfx.Play(CustomSFX.game_seedCrystalHeart_shard_collect, "shatter", allCollected ? 0f : 1f);
            Celeste.Freeze(.1f);
            level.Shake(.15f);
            level.Flash(XNAColor.White * .25f);

            if (allCollected)
            {
                Scene.Add(new CSGEN_HeartGemShards(Heart));
            }
        }
Esempio n. 4
0
        private IEnumerator RefillRoutine(Player player)
        {
            Celeste.Freeze(0.05f);
            Audio.Play(CustomSFX.game_shieldedRefill_diamondbubble_pop, Position);
            level.ParticlesFG.Emit(Player.P_CassetteFly, 6, Center, Vector2.One * 5f);
            yield return(null);

            level.Shake();
            sprite.Visible = (flash.Visible = false);
            if (!oneUse)
            {
                outline.Visible = true;
            }
            Depth = Depths.BGDecals * 1;
            yield return(0.05f);

            float num = player.Speed.Angle();

            level.ParticlesFG.Emit(p_shatter, 5, Position, Vector2.One * 4f, num - (float)Math.PI / 2f);
            level.ParticlesFG.Emit(p_shatter, 5, Position, Vector2.One * 4f, num + (float)Math.PI / 2f);
            SlashFx.Burst(Position, num);
            if (oneUse)
            {
                RemoveSelf();
            }
        }
Esempio n. 5
0
        public IEnumerator RefillRoutine(Player player)
        {
            Celeste.Freeze(0.025f);

            baseData.Get <Sprite>("sprite").Visible = baseData.Get <Sprite>("flash").Visible = false;
            bool oneUse = baseData.Get <bool>("oneUse");

            if (!oneUse)
            {
                baseData.Get <Image>("outline").Visible = true;
            }
            yield return(0.05);

            player.StateMachine.State = 0;
            float angle = player.Speed.Angle();
            Level level = baseData.Get <Level>("level");

            level.ParticlesFG.Emit(P_Shatter, 5, Position, Vector2.One * 4f, angle - (float)Math.PI / 2f);
            level.ParticlesFG.Emit(P_Shatter, 5, Position, Vector2.One * 4f, angle + (float)Math.PI / 2f);
            SlashFx.Burst(Position, angle);
            if (oneUse)
            {
                RemoveSelf();
            }
        }
Esempio n. 6
0
        private IEnumerator DeathRoutine()
        {
            Level level = SceneAs <Level>();

            if (bounce != Vector2.Zero)
            {
                scale = 1.5f;

                playAudio("event:/char/madeline/predeath", Position);
                Celeste.Freeze(0.05f);

                yield return(null);

                Vector2 from = Position;
                Vector2 to   = from + bounce * 24f;

                Tween tween = Tween.Create(Tween.TweenMode.Oneshot, Ease.CubeOut, 0.5f, start: true);
                Add(tween);

                tween.OnUpdate = delegate(Tween t)
                {
                    Position        = from + (to - from) * t.Eased;
                    scale           = 1.5f - t.Eased * 0.5f;
                    sprite.Rotation = (float)(Math.Floor(t.Eased * 4f) * 6.2831854820251465);
                };

                yield return(tween.Duration * 0.75f);

                tween.Stop();
            }

            Position += Vector2.UnitY * -5f;

            level.Displacement.AddBurst(Position, 0.3f, 0f, 80f);
            level.Shake();
            Input.Rumble(RumbleStrength.Strong, RumbleLength.Long);

            playAudio(HasGolden ? "event:/new_content/char/madeline/death_golden" : "event:/char/madeline/death", Position);

            deathEffect          = new DeathEffect(initialHairColor, Center - Position);
            deathEffect.OnUpdate = delegate(float f)
            {
                light.Alpha = 1f - f;
            };
            Add(deathEffect);

            yield return(deathEffect.Duration * 0.65f);

            if (ActionDelay > 0f)
            {
                yield return(ActionDelay);
            }

            End();
        }
        private void OnPlayerBounce(Player player)
        {
            if (CollideCheck(player))
            {
                return;
            }

            Celeste.Freeze(0.1f);
            player.Bounce(Top - 2f);
            Destroy();
            Audio.Play("event:/game/general/thing_booped", Position);
        }
 private void makeDisappear(Player player, float angle)
 {
     if (Collidable)
     {
         Collidable   = (Visible = false);
         respawnTimer = 3f;
         Celeste.Freeze(0.05f);
         SceneAs <Level>().Shake();
         SlashFx.Burst(Position, angle);
         player?.RefillDash();
     }
 }
Esempio n. 9
0
        private IEnumerator ChargeUpCoroutine()
        {
            Celeste.Freeze(0.05f);
            Distort.Anxiety = 0.3f;
            Input.Rumble(RumbleStrength.Strong, RumbleLength.Medium);
            lightningVisible = true;
            lightning.Play("once", true);
            yield return(0.3f);

            Player player = Scene.Tracker.GetEntity <Player>();

            state.State = player == null ? StChase : StAttack;
        }
Esempio n. 10
0
        public override void OnEnter(Player player)
        {
            Level level = Scene as Level;

            if (level.CoreMode == mode)
            {
                return;
            }
            level.CoreMode = mode;
            Input.Rumble(RumbleStrength.Medium, RumbleLength.Medium);
            level.Flash(Color.White * 0.15f, true);
            Celeste.Freeze(0.05f);
        }
Esempio n. 11
0
        private void OnPlayerBounce(Player player)
        {
            if (state.State != StAttack || player.Bottom > Top + 6.0)
            {
                return;
            }

            Audio.Play("event:/game/general/thing_booped", Position);
            Celeste.Freeze(0.2f);
            player.Bounce(Top + 2f);
            state.State = StHurt;
            prechargeSfx.Stop();
            chargeSfx.Stop();
        }
Esempio n. 12
0
 private void GotBouncedOn(Entity entity)
 {
     Celeste.Freeze(0.15f);
     if (pattern != FinalPattern)
     {
         state.State            = 1;
         sprite.Scale           = new Vector2(1.4f, 0.6f);
         attackCoroutine.Active = false;
         ChangeWind(WindController.Patterns.None);
         entity.Visible = true;
         SceneAs <Level>().Particles.Emit(Seeker.P_Stomp, 8, Center - Vector2.UnitY * 5f, new Vector2(6f, 3f));
     }
     else
     {
         Die();
     }
 }
Esempio n. 13
0
        public override void OnEnter(Player player)
        {
            Level level = base.Scene as Level;

            if (BGModeToggle.BGMode != mode)
            {
                BGModeToggle.BGMode = mode;
                if (persistant)
                {
                    BGModeToggle.Persist = mode;
                }
                BGModeToggle.UpdateBG(level);
                Input.Rumble(RumbleStrength.Medium, RumbleLength.Medium);
                Celeste.Freeze(0.05f);
                Add(new Coroutine(BGModeToggle.FlipFlash(level)));
            }
        }
Esempio n. 14
0
        private void OnPlayer(Player player)
        {
            if (Usable && cooldownTimer <= 0f)
            {
                playSounds = !silent;
                flagActive = !flagActive;
                setFlag();
                SetSprite(true);

                Level level = SceneAs <Level>();

                Input.Rumble(RumbleStrength.Medium, RumbleLength.Medium);
                level.Flash(Color.White * 0.15f, drawPlayerOver: true);
                Celeste.Freeze(0.05f);
                cooldownTimer = 1f;
            }
        }
Esempio n. 15
0
        private bool dreamDashRedirect(Player player)
        {
            if (player.StateMachine.State == Player.StDreamDash)
            {
                playerDashCooldownTimerMethod.SetValue(player, 0f);

                if (player.CanDash)
                {
                    bool sameDirection = Input.GetAimVector() == player.DashDir;

                    if (AllowDreamDashRedirection && !sameDirection || AllowSameDirectionDash && sameDirection)
                    {
                        player.Dashes = Math.Max(0, player.Dashes - 1);

                        Audio.Play("event:/char/madeline/dreamblock_enter");

                        // Freeze game when redirecting dash
                        // Consistent with dashing in the base game
                        if (Engine.TimeRate > 0.25f)
                        {
                            Celeste.Freeze(0.05f);
                        }

                        if (sameDirection)
                        {
                            player.Speed   *= sameDirectionSpeedMultiplier;
                            player.DashDir *= Math.Sign(sameDirectionSpeedMultiplier);
                        }
                        else
                        {
                            player.DashDir = Input.GetAimVector();
                            player.Speed   = player.DashDir * player.Speed.Length();
                        }

                        Input.Dash.ConsumeBuffer();

                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 16
0
        private IEnumerator SmashRoutine(Player player, Level level)
        {
            Visible        = false;
            Collidable     = false;
            player.Stamina = 110f;
            SoundEmitter.Play(SFX.game_07_gem_get, this, null);

            Session session = (Scene as Level).Session;

            session.DoNotLoad.Add(GID);
            CommunalHelperModule.Session.SummitGems.Add(CustomGemSID);
            CommunalHelperModule.SaveData.RegisterSummitGem(CustomGemSID);

            level.Shake(0.3f);
            Celeste.Freeze(0.1f);
            P_Shatter.Color = particleColor ?? GemColors[Calc.Clamp(GemID, 0, 7)];
            float angle = player.Speed.Angle();

            level.ParticlesFG.Emit(P_Shatter, 5, Position, Vector2.One * 4f, angle - Calc.QuarterCircle);
            level.ParticlesFG.Emit(P_Shatter, 5, Position, Vector2.One * 4f, angle + Calc.QuarterCircle);
            SlashFx.Burst(Position, angle);

            for (int i = 0; i < 10; i++)
            {
                Scene.Add(new AbsorbOrb(Position, player, null));
            }
            level.Flash(Color.White, true);
            Scene.Add((Entity)Activator.CreateInstance(t_BgFlash));

            Engine.TimeRate = 0.5f;
            while (Engine.TimeRate < 1f)
            {
                Engine.TimeRate += Engine.RawDeltaTime * 0.5f;
                yield return(null);
            }

            RemoveSelf();
            yield break;
        }
Esempio n. 17
0
        private IEnumerator RefillRoutine(Battery battery)
        {
            Celeste.Freeze(0.05f);
            yield return(null);

            level.Shake();
            sprite.Visible = (flash.Visible = false);
            if (!oneUse)
            {
                outline.Visible = true;
            }
            Depth = 8999;
            yield return(0.05f);

            float angle = battery.Speed.Angle();

            level.ParticlesFG.Emit(p_shatter, 5, Position, Vector2.One * 4f, angle - (float)Math.PI / 2f);
            level.ParticlesFG.Emit(p_shatter, 5, Position, Vector2.One * 4f, angle + (float)Math.PI / 2f);
            SlashFx.Burst(Position, angle);
            if (oneUse)
            {
                RemoveSelf();
            }
        }
Esempio n. 18
0
        private IEnumerator CollectRoutine(Player player)
        {
            Level   level        = Scene as Level;
            AreaKey area         = level.Session.Area;
            string  poemID       = AreaData.Get(level).Mode[(int)area.Mode].PoemID;
            bool    completeArea = IsCompleteArea(false);

            level.CanRetry = false;
            if (completeArea)
            {
                Audio.SetMusic(null);
                Audio.SetAmbience(null);
            }
            if (completeArea)
            {
                List <Strawberry> strawbs = new List <Strawberry>();
                foreach (Follower follower in player.Leader.Followers)
                {
                    if (follower.Entity is Strawberry)
                    {
                        strawbs.Add(follower.Entity as Strawberry);
                    }
                }
                foreach (Strawberry strawb in strawbs)
                {
                    strawb.OnCollect();
                }
            }
            string sfxEvent = "event:/game/general/crystalheart_blue_get";

            if (area.Mode == AreaMode.BSide)
            {
                sfxEvent = "event:/game/general/crystalheart_red_get";
            }
            else if (area.Mode == AreaMode.CSide)
            {
                sfxEvent = "event:/game/general/crystalheart_gold_get";
            }
            sfx = SoundEmitter.Play(sfxEvent, this);
            Add(new LevelEndingHook(delegate
            {
                sfx.Source.Stop();
            }));
            walls.Add(new InvisibleBarrier(new Vector2(level.Bounds.Right, level.Bounds.Top), 8f, level.Bounds.Height));
            walls.Add(new InvisibleBarrier(new Vector2(level.Bounds.Left - 8, level.Bounds.Top), 8f, level.Bounds.Height));
            walls.Add(new InvisibleBarrier(new Vector2(level.Bounds.Left, level.Bounds.Top - 8), level.Bounds.Width, 8f));
            foreach (InvisibleBarrier wall in walls)
            {
                Scene.Add(wall);
            }
            Add(white = GFX.SpriteBank.Create("heartGemWhite"));
            Depth     = -2000000;
            yield return(null);

            Celeste.Freeze(0.2f);
            yield return(null);

            Engine.TimeRate = 0.5f;
            player.Depth    = -2000000;
            for (int i = 0; i < 10; i++)
            {
                Scene.Add(new AbsorbOrb(Position));
            }
            level.Shake();
            Input.Rumble(RumbleStrength.Strong, RumbleLength.Medium);
            level.Flash(Color.White);
            level.FormationBackdrop.Display = true;
            level.FormationBackdrop.Alpha   = 1f;
            light.Alpha = (bloom.Alpha = 0f);
            Visible     = false;
            for (float t3 = 0f; t3 < 2f; t3 += Engine.RawDeltaTime)
            {
                Engine.TimeRate = Calc.Approach(Engine.TimeRate, 0f, Engine.RawDeltaTime * 0.25f);
                yield return(null);
            }
            yield return(null);

            if (player.Dead)
            {
                yield return(100f);
            }
            Engine.TimeRate = 1f;
            Tag             = Tags.FrozenUpdate;
            level.Frozen    = true;
            RegisterAsCollected(level, poemID);
            if (completeArea)
            {
                level.TimerStopped = true;
                level.RegisterAreaComplete();
            }
            string poemText = null;

            if (!string.IsNullOrEmpty(poemID))
            {
                poemText = Dialog.Clean("poem_" + poemID);
            }
            poem       = new Poem(poemText, (int)area.Mode, (area.Mode == AreaMode.CSide) ? 1f : 0.6f);
            poem.Alpha = 0f;
            Scene.Add(poem);
            for (float t2 = 0f; t2 < 1f; t2 += Engine.RawDeltaTime)
            {
                poem.Alpha = Ease.CubeOut(t2);
                yield return(null);
            }
            while (!Input.MenuConfirm.Pressed && !Input.MenuCancel.Pressed)
            {
                yield return(null);
            }
            sfx.Source.Param("end", 1f);
            if (!completeArea)
            {
                level.FormationBackdrop.Display = false;
                for (float t = 0f; t < 1f; t += Engine.RawDeltaTime * 2f)
                {
                    poem.Alpha = Ease.CubeIn(1f - t);
                    yield return(null);
                }
                player.Depth = 0;
                EndCutscene();
            }
            else
            {
                yield return(new FadeWipe(level, wipeIn: false)
                {
                    Duration = 3.25f
                }.Duration);

                level.CompleteArea(spotlightWipe: false, skipScreenWipe: true, skipCompleteScreen: false);
            }
        }
Esempio n. 19
0
        private IEnumerator SmashRoutine(Player player, Level level)
        {
            level.CanRetry     = false;
            inCollectAnimation = true;

            Collidable = false;

            // mute sound
            Audio.SetMusic(null);
            Audio.SetAmbience(null);

            // collect all berries
            List <IStrawberry>        list       = new List <IStrawberry>();
            ReadOnlyCollection <Type> berryTypes = StrawberryRegistry.GetBerryTypes();

            foreach (Follower follower in player.Leader.Followers)
            {
                if (berryTypes.Contains(follower.Entity.GetType()) && follower.Entity is IStrawberry)
                {
                    list.Add(follower.Entity as IStrawberry);
                }
            }
            foreach (IStrawberry item in list)
            {
                item.OnCollect();
            }

            // play the collect jingle
            SoundEmitter.Play("event:/SC2020_heartShard_get", this);

            // overlap a white sprite
            Add(white = new Sprite(GFX.Game, "CollabUtils2/miniheart/white/white"));
            white.AddLoop("idle", "", 0.1f, animationFrames);
            white.Play("idle");
            white.CenterOrigin();

            // slow down time, visual effects
            Depth = -2000000;
            yield return(null);

            Celeste.Freeze(0.2f);
            yield return(null);

            Engine.TimeRate = 0.5f;
            player.Depth    = -2000000;
            for (int i = 0; i < 10; i++)
            {
                Scene.Add(new AbsorbOrb(Position));
            }
            level.Shake();
            Input.Rumble(RumbleStrength.Strong, RumbleLength.Medium);
            level.Flash(Color.White);
            light.Alpha = (bloom.Alpha = 0f);
            level.FormationBackdrop.Display = true;
            level.FormationBackdrop.Alpha   = 1f;

            // slow down time further, to a freeze
            Visible = false;
            for (float time = 0f; time < 2f; time += Engine.RawDeltaTime)
            {
                Engine.TimeRate = Calc.Approach(Engine.TimeRate, 0f, Engine.RawDeltaTime * 0.25f);
                yield return(null);
            }
            yield return(null);

            if (player.Dead)
            {
                yield return(100f);
            }

            Engine.TimeRate = 1f;
            Tag             = Tags.FrozenUpdate;
            level.Frozen    = true;

            // level is done! stop timer, save completion
            SaveData.Instance.RegisterHeartGem(level.Session.Area);
            level.TimerStopped = true;
            level.PauseLock    = true;
            level.RegisterAreaComplete();

            // display an endscreen if enabled in mod options AND speedrun timer is enabled (or else the endscreen won't show anything anyway).
            if (CollabModule.Instance.Settings.DisplayEndScreenForAllMaps && Settings.Instance.SpeedrunClock != SpeedrunType.Off)
            {
                Scene.Add(new AreaCompleteInfoInLevel());

                // force the player to wait a bit, so that the info shows up
                yield return(0.5f);

                // wait for an input
                while (!Input.MenuConfirm.Pressed && !Input.MenuCancel.Pressed)
                {
                    yield return(null);
                }
            }
            else
            {
                // wait 1 second max
                float timer = 0f;
                while (!Input.MenuConfirm.Pressed && !Input.MenuCancel.Pressed && timer <= 1f)
                {
                    yield return(null);

                    timer += Engine.DeltaTime;
                }
            }

            // get out of here, back to the lobby
            level.DoScreenWipe(false, () => Engine.Scene = new LevelExitToLobby(LevelExit.Mode.Completed, level.Session));
        }
        private static int DreamTunnelDashUpdate(this Player player)
        {
            DynData <Player> playerData = player.GetData();

            if (FeatherMode)
            {
                Vector2 input = Input.Aim.Value.SafeNormalize();
                if (input != Vector2.Zero)
                {
                    Vector2 vector = player.Speed.SafeNormalize();
                    if (vector != Vector2.Zero)
                    {
                        vector         = Vector2.Dot(input, vector) != -0.8f ? vector.RotateTowards(input.Angle(), 5f * Engine.DeltaTime) : vector;
                        vector         = vector.CorrectJoystickPrecision();
                        player.DashDir = vector;
                        player.Speed   = vector * 240f;
                    }
                }
            }

            Input.Rumble(RumbleStrength.Light, RumbleLength.Medium);
            Vector2 position = player.Position;

            player.NaiveMove(player.Speed * Engine.DeltaTime);
            float dreamDashCanEndTimer = playerData.Get <float>(Player_dreamTunnelDashCanEndTimer);

            if (dreamDashCanEndTimer > 0f)
            {
                playerData[Player_dreamTunnelDashCanEndTimer] = dreamDashCanEndTimer - Engine.DeltaTime;
            }
            Solid solid = player.CollideFirst <Solid, DreamBlock>();

            if (solid == null)
            {
                if (player.DreamTunneledIntoDeath())
                {
                    player.DreamDashDie(position);
                }
                else if (playerData.Get <float>(Player_dreamTunnelDashCanEndTimer) <= 0f)
                {
                    Celeste.Freeze(0.05f);
                    if (Input.Jump.Pressed && player.DashDir.X != 0f)
                    {
                        playerData["dreamJump"] = true;
                        player.Jump(true, true);
                    }
                    else if (player.DashDir.Y >= 0f || player.DashDir.X != 0f)
                    {
                        if (player.DashDir.X > 0f && player.CollideCheck <DreamBlock>(player.Position - Vector2.UnitX * 5f))
                        {
                            player.MoveHExact(-5, null, null);
                        }
                        else if (player.DashDir.X < 0f && player.CollideCheck <DreamBlock>(player.Position + Vector2.UnitX * 5f))
                        {
                            player.MoveHExact(5, null, null);
                        }
                        bool flag  = player.ClimbCheck(-1, 0);
                        bool flag2 = player.ClimbCheck(1, 0);
                        int  moveX = playerData.Get <int>("moveX");
                        if (Input.Grab.Check && ((moveX == 1 && flag2) || (moveX == -1 && flag)))
                        {
                            player.Facing = (Facings)moveX;
                            if (!SaveData.Instance.Assists.NoGrabbing)
                            {
                                return(Player.StClimb);
                            }
                            player.ClimbTrigger(moveX);
                            player.Speed.X = 0f;
                        }
                    }
                    return(Player.StNormal);
                }
            }
            else
            {
                playerData[Player_solid] = solid;
                if (player.Scene.OnInterval(0.1f))
                {
                    player.CreateDreamTrail();
                }
                Level level = playerData.Get <Level>("level");
                if (level.OnInterval(0.04f))
                {
                    DisplacementRenderer.Burst burst = level.Displacement.AddBurst(player.Center, 0.3f, 0f, 40f, 1f, null, null);
                    burst.WorldClipCollider = solid.Collider;
                    burst.WorldClipPadding  = 2;
                }
            }
            return(StDreamTunnelDash);
        }