示例#1
0
    void SelectCollection(SkillsCollection selectedCollection)
    {
        _currentSelectedCollection         = selectedCollection;
        _collectionContainer.style.display = DisplayStyle.None;

        _spellContainer = _root.Q("SpellsContainer");
        _spellContainer.Clear();
        _title.text = _currentSelectedCollection.name;

        foreach (var skill in _currentSelectedCollection.Skills)
        {
            var button = new Button(() => SelectSkill(skill));
            button.AddToClassList("SkillButton");
            button.styleSheets.Add(_styleSheet);

            var label = new Label(skill.displayName);
            label.AddToClassList("SkillButtonTitle");
            label.styleSheets.Add(_styleSheet);
            button.Add(label);

            var icon = new Image();
            icon.AddToClassList("SkillButtonIcon");
            icon.styleSheets.Add(_styleSheet);
            icon.image = skill.icon.texture;
            button.Add(icon);

            _spellContainer.Add(button);
        }

        _spellContainer.style.display         = DisplayStyle.Flex;
        _backToCollectionButton.style.display = DisplayStyle.Flex;
    }
示例#2
0
 void Start()
 {
     EquipWeapon();
     _skillsCollection = GetComponent <SkillsCollection>();
     foreach (var skill in _skillsCollection.Skills)
     {
         skill.CurrentCooldownTime = skill.CooldownTime;
     }
     if (_skillsCollection.Skills.Length >= 1)
     {
         skillLayout.Add(KeyCode.Q, _skillsCollection.Skills[0]);
         EquipMainSkill(skillLayout[KeyCode.Q], true);
     }
     if (_skillsCollection.Skills.Length >= 2)
     {
         skillLayout.Add(KeyCode.E, _skillsCollection.Skills[1]);
         EquipMainSkill(skillLayout[KeyCode.E], false);
     }
     if (_skillsCollection.Skills.Length >= 3)
     {
         skillLayout.Add(KeyCode.LeftShift, _skillsCollection.Skills[2]);
         EquipShiftSkill(skillLayout[KeyCode.LeftShift]);
     }
 }