예제 #1
0
    public void UnlockSkill(int skillID)
    {
        skillTree.ActivateSkill(stats.AlterExperienceValue(), skillID);
        SkillData data = skillTree.GetSkillData(skillID);
        float     value;

        switch (data.skillType)
        {
        case SkillData.SkillType.Passive:
            switch (data.statModificationCategory)
            {
            case SkillData.StatModificationCategory.Health:
                value = stats.AlterHealthValue();
                value = (value * (data.additivePercentage / 100));
                stats.AlterHealthValue(value);
                break;

            case SkillData.StatModificationCategory.Damage:
                value = stats.AlterDamageValue();
                value = (value * (data.additivePercentage / 100));
                stats.AlterDamageValue(value);
                break;

            case SkillData.StatModificationCategory.Endurance:
                value = stats.AlterEnduranceValue();
                value = (value * (data.additivePercentage / 100));
                stats.AlterEnduranceValue(value);
                break;
            }
            break;

        case SkillData.SkillType.Ability:
            Debug.Log("Ability Unlocked");
            int    _id;
            string _name;
            bool   _unlocked;
            for (int i = 0; i < abilities.Count; i++)
            {
                abilities[i].GetAbilityData(out _id, out _name, out _unlocked);
                if (_id == data.abilityID)
                {
                    abilities[i].SetAbilityData(_id, _name, true);
                }
            }
            break;
        }
    }