public void _LaunchAbility(int index = -1) { if (instance == null) { return; } //make sure we have a valid selected ability index = index < 0 ? selectedID : index; if (index < 0 || index >= abilityList.Count) { return; } //check if the selected ability is ready string status = abilityList[index].IsReady(); //if the abilty is not ready, fire event explaining why (for UI) if (status != "") { TDS.AbilityActivationFailFail(status); return; } //call function to launch ability LaunchAbility(abilityList[index]); }