diff --git a/Assets/Scripts/Managers/GameOverManager.cs b/Assets/Scripts/Managers/GameOverManager.cs index 6eb8a464d542656d5df3bee0651434c586353754..f32fc211ed3ef074dbd1f51fce2215c21479836c 100644 --- a/Assets/Scripts/Managers/GameOverManager.cs +++ b/Assets/Scripts/Managers/GameOverManager.cs @@ -9,7 +9,7 @@ namespace Nightmare public Canvas gameOverCanvas; public GameObject[] hideCanvases; public float delayBeforeGameOver = 3f; // Delay in seconds - public float delayBeforeReturnToMainMenu = 9f; // Delay in seconds before returning to main menu + public float delayBeforeReturnToMainMenu = 6f; // Delay in seconds before returning to main menu private float gameOverTimer = 0f; private float returnToMainMenuTimer = 0f; @@ -31,10 +31,9 @@ namespace Nightmare if (gameOverTimer > 0f) { gameOverTimer -= Time.deltaTime; - if (gameOverTimer <= 0f) + if (gameOverTimer <= 0f && returnToMainMenuTimer <= 0f) { returnToMainMenuTimer = delayBeforeReturnToMainMenu; - GoToMainMenu(); } } diff --git a/Assets/Scripts/Utils/DataSaver.cs b/Assets/Scripts/Utils/DataSaver.cs index fc5380f0d7645c631ed374baf23489ee7d0ebcc7..6d2548160e77f44abf6007416b07e4f0f8c9663a 100644 --- a/Assets/Scripts/Utils/DataSaver.cs +++ b/Assets/Scripts/Utils/DataSaver.cs @@ -24,11 +24,11 @@ public class DataSaver try { File.WriteAllBytes(tempPath, jsonByte); - Debug.Log("Saved Data to: " + tempPath.Replace("/", "\\")); + Debug.Log("Successfully saved to: " + tempPath.Replace("/", "\\")); } catch (Exception e) { - Debug.LogWarning("Failed To PlayerInfo Data to: " + tempPath.Replace("/", "\\")); + Debug.LogWarning("Failed To get player info: " + tempPath.Replace("/", "\\")); Debug.LogWarning("Error: " + e.Message); } } @@ -39,16 +39,16 @@ public class DataSaver var tempPath = Path.Combine(Application.persistentDataPath, "data"); tempPath = Path.Combine(tempPath, dataFileName + ".txt"); - // Exit if Directory or File does not exist + // Exit if Directory or File not found if (!Directory.Exists(Path.GetDirectoryName(tempPath))) { - Debug.LogWarning("Directory does not exist"); + Debug.LogWarning("Directory not found"); return new T(); } if (!File.Exists(tempPath)) { - Debug.Log("File does not exist"); + Debug.Log("File not found"); return new T(); } @@ -57,11 +57,11 @@ public class DataSaver try { jsonByte = File.ReadAllBytes(tempPath); - Debug.Log("Loaded Data from: " + tempPath.Replace("/", "\\")); + Debug.Log("Successfully load data: " + tempPath.Replace("/", "\\")); } catch (Exception e) { - Debug.LogWarning("Failed To Load Data from: " + tempPath.Replace("/", "\\")); + Debug.LogWarning("Failed to load: " + tempPath.Replace("/", "\\")); Debug.LogWarning("Error: " + e.Message); } @@ -85,25 +85,25 @@ public class DataSaver // Exit if Directory or File does not exist if (!Directory.Exists(Path.GetDirectoryName(tempPath))) { - Debug.LogWarning("Directory does not exist"); + Debug.LogWarning("Directory not found"); return false; } if (!File.Exists(tempPath)) { - Debug.Log("File does not exist"); + Debug.Log("File not found"); return false; } try { File.Delete(tempPath); - Debug.Log("Data deleted from: " + tempPath.Replace("/", "\\")); + Debug.Log("Successfully deleted data: " + tempPath.Replace("/", "\\")); success = true; } catch (Exception e) { - Debug.LogWarning("Failed To Delete Data: " + e.Message); + Debug.LogWarning("Failed to delete data: " + e.Message); } return success;