public void AttachPassives() { foreach (AbilityModule ab in abilitySlots) { if (ab.passive) { PassiveAbility passiveAbility = ab.GetComponent <PassiveAbility>(); passiveAbility.Attach(); } } }
public void ReplaceAbility(GameObject abi, int slot) { GameObject abilityObj = Instantiate(abi) as GameObject; AbilityModule ability = abilityObj.GetComponent <AbilityModule>(); AbilityModule unequip = abilitySlots[slot - 1]; if (unequip.passive) { PassiveAbility unequipPassive = unequip.GetComponent <PassiveAbility>(); unequipPassive.Detach(); } Destroy(unequip.gameObject); if (ability.passive) { PassiveAbility equipPassive = ability.GetComponent <PassiveAbility>(); equipPassive.Attach(); } abilitySlots[slot - 1] = ability; abilitySlots[slot - 1].cooldownImage = abilityCooldownImages[slot - 1]; abilityCooldownImages[slot - 1].sprite = abilitySlots[slot - 1].abilityCircleIcon; abilityOnCooldownImages[slot - 1].sprite = abilitySlots[slot - 1].abilityCircleIcon; abilitySlots[slot - 1].abilityText = abilityNameTexts[slot - 1]; abilitySlots[slot - 1].bottomImage = abilityBottomImages[slot - 1]; abilityBottomImages[slot - 1].sprite = abilitySlots[slot - 1].abilitySquareIcon; abilitySlots[slot - 1].bottomText = abilityBottomTexts[slot - 1]; //abilitySlots[slot - 1].abilityIcon = abilityIconImages[slot - 1]; abilitySlots[slot - 1].abilityButtonText = abilityButtonTexts[slot - 1]; }