コード例 #1
0
ファイル: GameManager.cs プロジェクト: Parakoopa/RogueEssence
 public void MoveToScene(BaseScene scene)
 {
     //need to transfer player data
     CurrentScene = scene;
     CurrentScene.Begin();
 }
コード例 #2
0
ファイル: GameManager.cs プロジェクト: Parakoopa/RogueEssence
        public IEnumerator <YieldInstruction> MoveToZone(ZoneLoc destId, bool forceNewZone = false, bool preserveMusic = false)
        {
            bool      newGround = (destId.StructID.Segment <= -1);
            BaseScene destScene = newGround ? (BaseScene)GroundScene.Instance : DungeonScene.Instance;

            exitMap(destScene);

            //switch location
            if (destId.ID == ZoneManager.Instance.CurrentZoneID && !forceNewZone)
            {
                ZoneManager.Instance.CurrentZone.SetCurrentMap(destId.StructID);
            }
            else
            {
                ZoneManager.Instance.MoveToZone(destId.ID, destId.StructID, unchecked (DataManager.Instance.Save.Rand.FirstSeed + (ulong)destId.ID));//NOTE: there are better ways to seed a multi-dungeon adventure
                yield return(CoroutineManager.Instance.StartCoroutine(ZoneManager.Instance.CurrentZone.OnInit()));
            }

            //Transparency mode
            MenuBase.Transparent = !newGround;

            //switch in new scene
            MoveToScene(destScene);
            if (newGround && CurrentScene != GroundScene.Instance)
            {
                LuaEngine.Instance.OnGroundModeBegin();
            }
            else if (!newGround && CurrentScene != DungeonScene.Instance)
            {
                LuaEngine.Instance.OnDungeonModeBegin();
            }


            if (newGround)
            {
                if (!preserveMusic)
                {
                    BGM(ZoneManager.Instance.CurrentGround.Music, true);
                }

                GroundScene.Instance.EnterGround(destId.EntryPoint);
                yield return(CoroutineManager.Instance.StartCoroutine(GroundScene.Instance.InitGround()));

                //no fade; the script handles that itself
                yield return(CoroutineManager.Instance.StartCoroutine(GroundScene.Instance.BeginGround()));
            }
            else
            {
                if (!preserveMusic)
                {
                    BGM(ZoneManager.Instance.CurrentMap.Music, true);
                }

                DungeonScene.Instance.EnterFloor(destId.EntryPoint);
                yield return(CoroutineManager.Instance.StartCoroutine(DungeonScene.Instance.PrepareFloor()));

                if (IsFaded())
                {
                    if (ZoneManager.Instance.CurrentMap.DropTitle)
                    {
                        yield return(CoroutineManager.Instance.StartCoroutine(FadeTitle(true, ZoneManager.Instance.CurrentMap.Name.ToLocal())));

                        yield return(new WaitForFrames(30));

                        yield return(CoroutineManager.Instance.StartCoroutine(FadeTitle(false, "")));
                    }
                    yield return(CoroutineManager.Instance.StartCoroutine(FadeIn()));
                }

                yield return(CoroutineManager.Instance.StartCoroutine(DungeonScene.Instance.BeginFloor()));
            }
            DataManager.Instance.Save.NextDest = ZoneLoc.Invalid;
        }