From 7ff2d07c5b132c36aa7f4a3b41e0463e9f536841 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Sat, 26 Feb 2022 12:59:30 +0300 Subject: [PATCH] Level Manager Improvement --- Assets/Resources/Levels/{99.prefab => 8.prefab} | 0 Assets/Resources/Levels/{99.prefab.meta => 8.prefab.meta} | 0 Assets/Scripts/Level/LevelManager.cs | 6 ++++++ 3 files changed, 6 insertions(+) rename Assets/Resources/Levels/{99.prefab => 8.prefab} (100%) rename Assets/Resources/Levels/{99.prefab.meta => 8.prefab.meta} (100%) diff --git a/Assets/Resources/Levels/99.prefab b/Assets/Resources/Levels/8.prefab similarity index 100% rename from Assets/Resources/Levels/99.prefab rename to Assets/Resources/Levels/8.prefab diff --git a/Assets/Resources/Levels/99.prefab.meta b/Assets/Resources/Levels/8.prefab.meta similarity index 100% rename from Assets/Resources/Levels/99.prefab.meta rename to Assets/Resources/Levels/8.prefab.meta diff --git a/Assets/Scripts/Level/LevelManager.cs b/Assets/Scripts/Level/LevelManager.cs index f028fec..592569a 100644 --- a/Assets/Scripts/Level/LevelManager.cs +++ b/Assets/Scripts/Level/LevelManager.cs @@ -77,6 +77,12 @@ namespace Level { DisableAllLevels(); + if (!Levels.ContainsKey(levelNumber)) + { + UIManager.Instance.SwitchToCanvas("Level Selection Menu"); + return; + } + currentLevel = Levels[levelNumber]; currentLevel.Enable();