public void Construct(ScoreCounter scoreCounter) { if (_scoreCounter != null) { CleanUp(); } _scoreCounter = scoreCounter; _scoreCounter.Changed += OnScoreChanged; _score.text = _scoreCounter.Value.ToString(); }
private void InitContext() { var player = GameObject.FindWithTag("Player"); _playerDestruct = player.GetComponent <Destructible>(); _playerWeapon = player.GetComponentInChildren <PlayerWeapon>(); _playerScore = player.GetComponent <ScoreCounter>(); //init sliders _healthSlider.maxValue = _playerDestruct.MaxArmor; _healthSlider.value = _playerDestruct.CurrentArmor; _shieldSlider.maxValue = _playerDestruct.MaxShield; _shieldSlider.value = _playerDestruct.CurrentShield; _energySlider.maxValue = _playerWeapon.MaxEnergy; _energySlider.value = _playerWeapon.CurrentEnergy; }
public void Construct(ScoreCounter counter) => _scoreView.Construct(counter);