day transition is now working

This commit is contained in:
dhain 2022-06-09 16:49:15 +02:00
parent a53857c4d2
commit 7b286bcfd9
13 changed files with 390 additions and 388 deletions

View file

@ -6,9 +6,10 @@ using UnityEngine;
using UnityEngine.Events;
public class HouseController : MonoBehaviour {
private int _dayCount = 1;
private static int _dayCount = 1;
private static UnityEvent _newDayEvent;
public static UnityEvent NewDayEvent => _newDayEvent;
public static int DayCount => _dayCount;
public Canvas menu;
public TextMeshProUGUI dayCountTextMeshProUGUI;
@ -18,8 +19,11 @@ public class HouseController : MonoBehaviour {
ToggleMenu();
}
void Start() {
private void Awake() {
_newDayEvent ??= new UnityEvent();
}
void Start() {
ToggleMenu();
}
@ -31,8 +35,7 @@ public class HouseController : MonoBehaviour {
public void ToggleMenu() {
menu.gameObject.SetActive(!menu.gameObject.activeSelf);
if (Camera.main != null) {
Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);
float newPosX = pos.x;