public override bool Equals(BaseElementalEffect other) { ElementalEffect eff = other as ElementalEffect; if (other == null) { return(false); } return(eff.m_DamageType == m_DamageType); }
/// <summary> /// Add an elemental effect to the StatSystem. Elemental Effect does not stack, adding the same type (the Equals /// return true) will instead replace the old one with the new one. /// </summary> /// <param name="effect"></param> public void AddElementalEffect(BaseElementalEffect effect) { effect.Applied(m_Owner); bool replaced = false; for (int i = 0; i < m_ElementalEffects.Count; ++i) { if (effect.Equals(m_ElementalEffects[i])) { replaced = true; m_ElementalEffects[i].Removed(); m_ElementalEffects[i] = effect; } } if (!replaced) { m_ElementalEffects.Add(effect); } }