示例#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;
        }
 public void Construct(ScoreCounter counter) =>
 _scoreView.Construct(counter);