private void LevelGenerationLogic(int nextLevelIndex, int currnetLevelIndex, bool _goingRight, bool _comingFromSideRoom) { if (ARinclude(nextLevelIndex, generatedLevels)) { levelGenerator.CloaseGeneratedLevel(currnetLevelIndex); levelGenerator.OpenGeneratedLevel(nextLevelIndex); loadedLevelInfo.FindMyPortals(); SetPlayerSpawenPoint(_goingRight, _comingFromSideRoom); SpawenPlayer(); } else { levelGenerator.CloaseGeneratedLevel(currnetLevelIndex); levelGenerator.map = loadedLevelInfo.GetLevelMap(); levelGenerator.GenerateLevel(nextLevelIndex); generatedLevels[genretedLevelsCount] = nextLevelIndex; loadedLevelInfo.FindMyPortals(); SetPlayerSpawenPoint(_goingRight, _comingFromSideRoom); SpawenPlayer(); genretedLevelsCount++; } }