2020-04-18 17:02:22 +00:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
2020-04-18 20:45:36 +00:00
|
|
|
|
|
2020-04-18 17:02:22 +00:00
|
|
|
|
public class TimePanel : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
private GameController gameController;
|
2020-04-18 20:45:36 +00:00
|
|
|
|
private Slider slider;
|
2020-04-18 17:02:22 +00:00
|
|
|
|
|
|
|
|
|
private void Awake() {
|
|
|
|
|
gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>();
|
2020-04-18 20:45:36 +00:00
|
|
|
|
slider = GetComponentInChildren<Slider>();
|
2020-04-18 17:02:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Start() {
|
|
|
|
|
gameController.OnMicrogameTimeLeftChange += OnMicrogameTimeLeftChange;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnMicrogameTimeLeftChange(float? previous, float? current) {
|
|
|
|
|
if(current.HasValue) {
|
2020-04-18 20:45:36 +00:00
|
|
|
|
slider.value = gameController.CurrentMicrogame.TimeFraction;
|
2020-04-18 17:02:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|