public void Activate(IFactory planetFactory)
 {
     SetTempFields(planetFactory);
     _planetName.text         = planetFactory.GetName();
     _factoryLevel.text       = FACTOY_LEVEL_TEXT + _tempFactoryLevel.GetLevel();
     _levelUpButton_text.text = (_tempFactoryLevel.GetLevel() > 0) ? LEVEL_UP_TEXT : FACTORY_BUILD_TEXT;
     _needMoney.text          = NEED_MONEY_TEXT + Converter.ValueToString(FactoryLevelling.CalculateNeedMoney(_tempFactoryLevel.GetLevel() + 1));
 }
Esempio n. 2
0
        public void LevelUp()
        {
            if (_currentPlanetWithFactory == null)
            {
                throw new NullReferenceException("CurrentPlanetWithFactory field is null.");
            }
            var _tempFactoryLevel = _currentPlanetWithFactory.GetLinkToIFactoryLevel();

            _tempNeedMoney = FactoryLevelling.CalculateNeedMoney(_tempFactoryLevel.GetLevel() + 1);
            if (_tempFactoryLevel.IsCanLevelUp() && StatsSystem.Instance.GetMoney() >= _tempNeedMoney)
            {
                StatsSystem.Instance.UseMoney(_tempNeedMoney);
                _tempFactoryLevel.LevelUp();
                _panel.UpdateText();
            }
        }