wirm/Game/Assets/Scripts/NextScene.cs

32 lines
744 B
C#
Raw Normal View History

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