private void Start() { model = TimerM.getInstance(); model.timerReactiveProperty .Subscribe(x => { TimeSpan temp = TimeSpan.FromSeconds(x); timerText.text = string.Format("{0:D2}:{1:D2}", temp.Minutes, temp.Seconds); timerBar.value = x / (float)model.maxTime; }); }
private void Awake() { maxTime = _maxTime; timerReactiveProperty = new IntReactiveProperty(_maxTime); if (_instance == null) { _instance = this; } else if (_instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }