public void AddSkill(SkillConfig skillConfig)
    {
        SkillButton sb = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.SkillButton].AllocateGameObject <SkillButton>(SkillButtonContainer);

        sb.Initialize(skillConfig, false, () =>
        {
            if (GameStateManager.Instance.GetState() == GameState.Playing)
            {
                LevelManager.Instance.CurrentSelectedSkillKey = skillConfig.SkillKey;
            }
        });
        SkillButtonDict.Add(skillConfig.SkillKey, sb);
    }
Beispiel #2
0
    public void AddSkill(SkillConfig skillConfig)
    {
        SkillButton sb = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.SkillButton].AllocateGameObject <SkillButton>(SkillButtonContainer);

        sb.Initialize(skillConfig, true, () =>
        {
            LevelManager.Instance.CurrentCoin -= skillConfig.CoinCost;
            RemoveSkill(skillConfig.SkillKey);
            StartCoroutine(ClientUtils.UpdateLayout((RectTransform)SkillButtonContainer.transform));
            LevelManager.Instance.AddSkill(skillConfig.SkillKey);
            RefreshAllSkillsAffordable();
        });

        StartCoroutine(ClientUtils.UpdateLayout((RectTransform)SkillButtonContainer.transform));
        SkillButtonDict.Add(skillConfig.SkillKey, sb);
    }