Example #1
0
        public static void Close(Level level, bool removeScene, bool resetPlayer)
        {
            if (removeScene)
            {
                overworldWrapper?.WrappedScene?.GetUI <OuiChapterPanel>().RemoveSelf();
                overworldWrapper?.WrappedScene?.Entities.UpdateLists();
                overworldWrapper?.RemoveSelf();

                if (lastArea != null && SaveData.Instance != null)
                {
                    SaveData.Instance.LastArea = lastArea.Value;
                    lastArea = null;
                    level.Entities.FindFirst <TotalStrawberriesDisplay>().Active = true;
                }
            }

            if (resetPlayer)
            {
                Player player = level.Tracker.GetEntity <Player>();
                if (player != null && player.StateMachine.State == Player.StDummy)
                {
                    Engine.Scene.OnEndOfFrame += () => {
                        player.StateMachine.State = Player.StNormal;
                    };
                }
            }
        }
Example #2
0
        private static IEnumerator UpdateRoutine(SceneWrappingEntity <Overworld> wrapper)
        {
            Level     level     = wrapper.Scene as Level;
            Overworld overworld = wrapper.WrappedScene;

            while (overworldWrapper?.Scene == Engine.Scene)
            {
                if (overworld.Next is OuiChapterSelect)
                {
                    overworld.Next.RemoveSelf();
                    overworldWrapper.Add(new Coroutine(DelayedCloseRoutine(level)));
                }

                overworld.Snow.ParticleAlpha = 0.25f;

                if (overworld.Current != null || overworld.Next?.Scene != null)
                {
                    overworld.Snow.Alpha = Calc.Approach(overworld.Snow.Alpha, 1f, Engine.DeltaTime * 2f);
                }
                else
                {
                    overworld.Snow.Alpha = Calc.Approach(overworld.Snow.Alpha, 0, Engine.DeltaTime * 2f);
                    if (overworld.Snow.Alpha <= 0.01f)
                    {
                        Close(level, true, true);
                    }
                }

                yield return(null);
            }

            if (wrapper.Scene != null)
            {
                wrapper.RemoveSelf();
            }
        }