Beispiel #1
0
    private void Start()
    {
        var currentSkin = _playerRepository.GetCurrentSkin();

        if (currentSkin != null)
        {
            _skin.SetSkin(currentSkin);
        }

        _currentBooster = FillingCurrentBooster().ToArray();
        var playerComponents = GetComponents <IPlayerComponent>();

        foreach (Booster booster in _currentBooster)
        {
            foreach (var component in playerComponents)
            {
                if (component.BoosterType == booster.Type)
                {
                    component.Initialization(UsedBooster, booster);
                }
            }
        }

        foreach (var skill in _skills)
        {
            skill.UseSkill(playerComponents);
        }
    }
Beispiel #2
0
    public void ToggleActiveObject(bool isShop, ModelSwitcher switcher)
    {
        _isShop   = isShop;
        _switcher = switcher;

        if (!SaveDataStorage.HasKeyBuyableObjecty(_defaultSkin))
        {
            _currentIdSkin = _defaultSkin.Id;
            _avatar.SetSkin(_defaultSkin);
            SaveDataStorage.SaveBuyableObject(_defaultSkin);
            ToggleActiveObject(_isShop, _switcher);
        }
        else
        {
            _currentIdSkin = SaveDataStorage.LoadCurrentRunnersId();
            _openedAvatars = SaveDataStorage.LoadOpenedRunnersIds();
            _avatar.SetSkin(_skins.Where(a => a.Id == _currentIdSkin).First());
            ChangePrice();
        }
    }