コード例 #1
0
        public void Construct(ScoreCounter scoreCounter)
        {
            if (_scoreCounter != null)
            {
                CleanUp();
            }

            _scoreCounter          = scoreCounter;
            _scoreCounter.Changed += OnScoreChanged;
            _score.text            = _scoreCounter.Value.ToString();
        }
コード例 #2
0
ファイル: Hud.cs プロジェクト: Jan5366x/ld43
        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;
        }
コード例 #3
0
 public void Construct(ScoreCounter counter) =>
 _scoreView.Construct(counter);