day transition is now working
This commit is contained in:
parent
a53857c4d2
commit
7b286bcfd9
13 changed files with 390 additions and 388 deletions
30
Assets/Scripts/DayTransitionManager.cs
Normal file
30
Assets/Scripts/DayTransitionManager.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DayTransitionManager : MonoBehaviour {
|
||||
public Animator dayTransitionAnimator;
|
||||
public TextMeshProUGUI dayCountText;
|
||||
public GameObject sleepButton;
|
||||
|
||||
private void Start() {
|
||||
HouseController.NewDayEvent.AddListener(NewDay);
|
||||
}
|
||||
|
||||
private void NewDay() {
|
||||
sleepButton.GetComponent<Button>().enabled = false;
|
||||
dayTransitionAnimator.gameObject.SetActive(true);
|
||||
StartCoroutine(PlayTransition());
|
||||
}
|
||||
|
||||
private IEnumerator PlayTransition() {
|
||||
dayCountText.text = "Day " + HouseController.DayCount;
|
||||
dayTransitionAnimator.SetTrigger("start");
|
||||
|
||||
yield return new WaitForSeconds(3f);
|
||||
sleepButton.GetComponent<Button>().enabled = true;
|
||||
dayTransitionAnimator.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue