public new void RegisterAreaComplete() { bool completed = Completed; if (!completed) { Player player = base.Tracker.GetEntity <Player>(); if (player != null) { List <IStrawberry> strawbs = new List <IStrawberry>(); ReadOnlyCollection <Type> regBerries = StrawberryRegistry.GetBerryTypes(); foreach (Follower follower in player.Leader.Followers) { if (regBerries.Contains(follower.Entity.GetType()) && follower.Entity is IStrawberry) { strawbs.Add(follower.Entity as IStrawberry); } } foreach (IStrawberry strawb in strawbs) { strawb.OnCollect(); } } Completed = true; SaveData.Instance.RegisterCompletion(Session); Everest.Events.Level.Complete(this); } }
private IEnumerator CollectRoutine(Player player) { Level level = Scene as Level; bool heartIsEnd = false; MapMetaModeProperties mapMetaModeProperties = (level != null) ? level.Session.MapData.GetMeta() : null; if (mapMetaModeProperties != null && mapMetaModeProperties.HeartIsEnd != null) { heartIsEnd = mapMetaModeProperties.HeartIsEnd.Value; } heartIsEnd &= !IsFake; if (heartIsEnd) { List <IStrawberry> strawbs = new List <IStrawberry>(); ReadOnlyCollection <Type> regBerries = StrawberryRegistry.GetBerryTypes(); foreach (Follower follower in player.Leader.Followers) { if (regBerries.Contains(follower.Entity.GetType()) && follower.Entity is IStrawberry) { strawbs.Add(follower.Entity as IStrawberry); } } foreach (IStrawberry strawb in strawbs) { strawb.OnCollect(); } } return(orig_CollectRoutine(player)); }
public override void OnStay(Player player) { base.OnStay(player); if (collectTimer <= 0f) { ReadOnlyCollection <Type> berryTypes = StrawberryRegistry.GetBerryTypes(); List <IStrawberry> followingBerries = new List <IStrawberry>(); foreach (Follower follower in player.Leader.Followers) { if (berryTypes.Contains(follower.Entity.GetType()) && follower.Entity is IStrawberry berry && (includeGoldens || !isGolden(berry))) { followingBerries.Add(berry); } } foreach (IStrawberry berry in followingBerries) { berry.OnCollect(); if (delayBetweenBerries) { collectTimer = 0.3f; break; } } } }
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)); }