From d326e662dde665e4eb1d03cb7d8203e8fe9a1cd5 Mon Sep 17 00:00:00 2001 From: Mark Joshwel Date: Fri, 14 Feb 2025 22:15:41 +0800 Subject: [PATCH] game(scripts): standardise DayIncrementPlaygroundScript --- .../Scripts/DayIncrementPlaygroundScript.cs | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/Game/Assets/Scripts/DayIncrementPlaygroundScript.cs b/Game/Assets/Scripts/DayIncrementPlaygroundScript.cs index 0e6b01a..b976ade 100644 --- a/Game/Assets/Scripts/DayIncrementPlaygroundScript.cs +++ b/Game/Assets/Scripts/DayIncrementPlaygroundScript.cs @@ -1,27 +1,30 @@ -using System; +/* + * Author: Mark + * Date: 10/2/2025 + * Description: Playground test script for day incrementation and game manager state preservation + */ + using System.Collections; -using System.Collections.Generic; -using Unity.VisualScripting; using UnityEngine; using UnityEngine.SceneManagement; public class DayIncrementPlaygroundScript : MonoBehaviour { - [SerializeField] public bool isBeforeScene = false; + [SerializeField] public bool isBeforeScene; - private bool _testHasRun = false; + private bool _testHasRun; private void Update() { if (_testHasRun) return; - + // fire off Main to run in the background StartCoroutine(Main()); - + _testHasRun = true; } - IEnumerator Main() + private IEnumerator Main() { if (isBeforeScene) { @@ -30,24 +33,24 @@ public class DayIncrementPlaygroundScript : MonoBehaviour yield return new WaitForSeconds(3); Debug.Log($"hello vro, day is {GameManager.Instance.currentDay}"); - + // get game manager and then increment the day GameManager.Instance.IncrementDay(); Debug.Log($"post-increment day is {GameManager.Instance.currentDay}"); - - // change to the next scene - SceneManager.LoadScene("Scenes/Testing Scenes/Day Increment Playground After"); + // change to the next scene + // ReSharper disable once Unity.LoadSceneDisabledSceneName + SceneManager.LoadScene("Scenes/Testing Scenes/Day Increment Playground After"); } else { // wait for 3 seconds Debug.Log("initialisation wait..."); yield return new WaitForSeconds(3); - + Debug.Log($"hello vro, day is {GameManager.Instance.currentDay}"); } - + yield return 0; } -} +} \ No newline at end of file