game(scripts): standardise NextScene

This commit is contained in:
Mark Joshwel 2025-02-15 00:36:00 +08:00
parent 3d57dbe7b7
commit 05367fb7ae

View file

@ -1,37 +1,32 @@
/* /*
Author: Reza * Author: Reza
Date: 13/2/25 * Date: 13/2/25
Description: Day 3 script that goes to the last scene after a certain amount of time * Description: Day 3 script that goes to the last scene after a certain amount of time
*/ */
using System.Collections;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement;
public class Day3 : MonoBehaviour public class Day3 : MonoBehaviour
{ {
// Time in seconds to wait before transitioning to the next scene // Time in seconds to wait before transitioning to the next scene
public float timeToWait = 60f; // Change this to the desired wait time public float timeToWait = 60f; // Change this to the desired wait time
private float timer; public string nextScene;
public string NextScene; private float _timer;
void Start() private void Start()
{ {
// Initialize timer // Initialize timer
timer = 0f; _timer = 0f;
} }
void Update() private void Update()
{ {
// Increment timer // Increment timer
timer += Time.deltaTime; _timer += Time.deltaTime;
// Check if the time has passed // Check if the time has passed
if (timer >= timeToWait) if (_timer >= timeToWait)
{
// Call method to change the scene // Call method to change the scene
GameManager.Instance.IncrementDay(); GameManager.Instance.IncrementDay();
}
} }
} }