private void skillSelected(CharacterSkill skill, int selectedIndex)
    {
        CharacterAttribute attribute = NeverdawnDatabase.GetAttribute(skill.baseAttribute);

        UIQuickMenuSkillUp skillUp = Instantiate(skillUpPrefab);

        int level = avatarController.character.GetSkillLevel(skill.type);

        skillUp.label          = skill.label;
        skillUp.description    = skill.description;
        skillUp.baseValue      = level;
        skillUp.attributeValue = avatarController.character.GetAttributeLevel(attribute.type);
        skillUp.equipmentValue = avatarController.character.mannequin ? avatarController.character.mannequin.GetSkillBonus(skill.type) : 0;
        skillUp.foodValue      = avatarController.character.GetFoodBonus(skill.type);
        skillUp.cost           = NeverdawnDatabase.GetUpgradeCost(skill.type, level);
        skillUp.learningPoints = avatarController.character.skillable.learningPoints;
        skillUp.showAttributes = true;
        skillUp.attributeColor = attribute.color;
        skillUp.attributeLabel = attribute.label;

        skillUp.confirm.interactable = avatarController.character.skillable.learningPoints >= NeverdawnDatabase.GetUpgradeCost(skill.type, level);
        skillUp.confirm.onClick.AddListener(() => skillUpSkill(skillUp, skill.type));

        this.selectedIndex = selectedIndex;
        menu.NavigateInto(skillUp);
    }
    private void attributeSelected(CharacterAttribute attribute, int selectedIndex)
    {
        int level = avatarController.character.GetAttributeLevel(attribute.type);

        UIQuickMenuSkillUp skillUp = Instantiate(skillUpPrefab);

        skillUp.label          = attribute.label;
        skillUp.description    = attribute.description;
        skillUp.baseValue      = level;
        skillUp.equipmentValue = avatarController.character.mannequin ? avatarController.character.mannequin.GetAttributeBonus(attribute.type) : 0;
        skillUp.foodValue      = avatarController.character.GetFoodBonus(attribute.type);
        skillUp.attributeValue = 0;
        skillUp.cost           = NeverdawnDatabase.GetUpgradeCost(attribute.type, level);
        skillUp.learningPoints = avatarController.character.skillable.learningPoints;
        skillUp.showAttributes = false;
        skillUp.baseColor      = attribute.color;
        //skillUp.currentLabel = "Current level";
        //skillUp.currentValue = avatarController.character.GetAttributeLevel(attribute.type).ToString();
        //skillUp.pointsLabel = "Remaining attribute points";
        //skillUp.pointsValue = avatarController.character.learningPoints.ToString();
        //skillUp.color = attribute.color;

        skillUp.confirm.interactable = avatarController.character.skillable.learningPoints >= NeverdawnDatabase.GetUpgradeCost(attribute.type, level);
        skillUp.confirm.onClick.AddListener(() => skillUpAttribute(skillUp, attribute.type));

        this.selectedIndex = selectedIndex;
        menu.NavigateInto(skillUp);
    }
Exemple #3
0
    internal void ImproveSkill(SkillType skillType)
    {
        int level = _skills[(int)skillType];
        int cost  = NeverdawnDatabase.GetUpgradeCost(skillType, level);

        if (learningPoints >= cost)
        {
            learningPoints -= cost;
            _skills[(int)skillType]++;
        }
    }
Exemple #4
0
    public void ImproveAttribute(AttributeType attributeType)
    {
        int level = _attributes[(int)attributeType];
        int cost  = NeverdawnDatabase.GetUpgradeCost(attributeType, level);

        if (learningPoints >= cost)
        {
            learningPoints -= cost;
            _attributes[(int)attributeType]++;
        }
    }
    private void skillUpAttribute(UIQuickMenuSkillUp sender, AttributeType attributeType)
    {
        int level = avatarController.character.GetAttributeLevel(attributeType);
        int cost  = NeverdawnDatabase.GetUpgradeCost(attributeType, level);

        avatarController.character.skillable.ImproveAttribute(attributeType);

        int newCost = NeverdawnDatabase.GetUpgradeCost(attributeType, level + 1);

        sender.confirm.interactable = avatarController.character.skillable.learningPoints >= newCost;
        sender.baseValue            = level + 1;
        sender.cost           = newCost;
        sender.learningPoints = avatarController.character.skillable.learningPoints;
    }