예제 #1
0
        private static void TeleportToNextRoom(Level level)
        {
            if (HistoryIndex >= 0 && HistoryIndex < RoomHistory.Count - 1)
            {
                HistoryIndex++;
                TeleportTo(RoomHistory[HistoryIndex]);
                return;
            }

            var levelDatas = LevelDataReorderUtils.GetReorderLevelDatas(level);

            if (levelDatas == null)
            {
                return;
            }

            LevelData currentLevelData = level.Session?.LevelData;

            if (currentLevelData == null)
            {
                return;
            }

            if (SearchSummitCheckpoint(level))
            {
                // 根据数据跳到下一个房间也需要记录
                RecordAndTeleport(level.Session);
                return;
            }

            int index = levelDatas.IndexOf(currentLevelData);

            if (index < 0 || index == levelDatas.Count - 1)
            {
                return;
            }

            index++;
            LevelData nextLevelData = levelDatas[index];

            while (nextLevelData.Dummy && index < levelDatas.Count - 1)
            {
                index++;
                nextLevelData = levelDatas[index];
            }

            if (nextLevelData.Dummy)
            {
                return;
            }

            level.Session.Level        = nextLevelData.Name;
            level.Session.RespawnPoint = null;

            SearchSummitCheckpoint(nextLevelData, level);
            // 根据数据跳到下一个房间也需要记录
            RecordAndTeleport(level.Session);
        }
예제 #2
0
        private static void TeleportToLastRoom(Level level)
        {
            if (HistoryIndex > 0 && HistoryIndex < RoomHistory.Count)
            {
                // Glyph 这种传送到其他房间是不做记录的,所以只回到当前记录的房间
                if (level.Session.Level == RoomHistory[HistoryIndex].Level)
                {
                    HistoryIndex--;
                }
                TeleportTo(RoomHistory[HistoryIndex]);
                return;
            }

            var levelDatas = LevelDataReorderUtils.GetReorderLevelDatas(level);

            if (levelDatas == null)
            {
                return;
            }

            LevelData currentLevelData = level.Session?.LevelData;

            if (currentLevelData == null)
            {
                return;
            }

            int index = levelDatas.IndexOf(currentLevelData);

            if (index <= 0)
            {
                return;
            }

            index--;
            LevelData lastLevelData = levelDatas[index];

            while (lastLevelData.Dummy && index > 0)
            {
                index--;
                lastLevelData = levelDatas[index];
            }

            if (lastLevelData.Dummy)
            {
                return;
            }

            level.Session.Level        = lastLevelData.Name;
            level.Session.RespawnPoint = null;
            TeleportTo(level.Session);
        }