Advertisement
evelynshilosky

TimeManager - Part 36

Mar 21st, 2024
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using TMPro;
  4. using UnityEngine;
  5.  
  6. public class TimeManager : MonoBehaviour
  7. {
  8.     public static TimeManager Instance { get; set; }
  9.  
  10.     private void Awake()
  11.     {
  12.         if (Instance != null && Instance != this)
  13.         {
  14.             Destroy(gameObject);
  15.         }
  16.         else
  17.         {
  18.             Instance = this;
  19.         }
  20.     }
  21.  
  22.     public int dayInGame = 1;
  23.     public TextMeshProUGUI dayUI;
  24.  
  25.     private void Start()
  26.     {
  27.         dayUI.text = $"Day {dayInGame}";
  28.     }
  29.  
  30.     public void TriggerNextDay()
  31.     {
  32.         dayInGame += 1;
  33.         dayUI.text = $"Day {dayInGame}";
  34.     }
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement