game(scripts): standardise DayIncrementPlaygroundScript
This commit is contained in:
parent
3465373560
commit
d326e662dd
1 changed files with 18 additions and 15 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue