private void OnWorldChanges(EWorldStatus newStatus) { if (this == null) { return; } var shouldBeVisible = _visibleStatus == newStatus; if (gameObject.activeSelf != shouldBeVisible) { gameObject.SetActive(shouldBeVisible); } }
public static EWorldStatus Advance(this EWorldStatus worldStatus) { switch (worldStatus) { case EWorldStatus.Living: return(EWorldStatus.Ghost); case EWorldStatus.Ghost: return(EWorldStatus.Living); default: throw new NotSupportedException("Unknown world status" + worldStatus); } }
void Update() { _countDown = _countDown.Subtract(TimeSpan.FromSeconds(Time.deltaTime)); _countDownChanges.OnNext(_countDown); if (Input.GetKeyDown(KeyCode.Space)) { _currentWorldStatus = _currentWorldStatus.Advance(); _worldChanges.OnNext(_currentWorldStatus); } if (_countDown.TotalSeconds <= 0 || _helpScore.isFinished()) { InputController.Instance._score = _helpScore.current + "/" + _helpScore.max; InputController.Instance._timeLeft = _countDown.ToString(); SceneManager.LoadScene("ScoreScene"); } }
private void OnWorldChanges(EWorldStatus newStatus) { _camera.backgroundColor = _colors[newStatus]; }