public void UnregisterSkill(BaseUnitSkill skill) { int skillIndex = _activeSkills.IndexOf(skill); if (skillIndex != -1) { _activeSkills.RemoveAt(skillIndex); } skillIndex = _damageModifyingSkills.IndexOf(skill); if (skillIndex != -1) { _damageModifyingSkills.RemoveAt(skillIndex); } }
public void RegisterSkill(BaseUnitSkill skill) { _activeSkills.Add(skill); if (_skillDamagePriorities.ContainsKey(skill.SkillParameters.Key)) { int skillPriority = _skillDamagePriorities[skill.SkillParameters.Key]; int insertIndex = _damageModifyingSkills.Count; for (int i = 0; i < _damageModifyingSkills.Count; i++) { if (skillPriority < _skillDamagePriorities[_damageModifyingSkills[i].SkillParameters.Key]) { insertIndex = i; break; } } _damageModifyingSkills.Insert(insertIndex, skill); } }