/// <summary> /// Removes the <see cref="ITemporaryMapEffect"/>s for the given <see cref="Character"/> from the /// <see cref="_activeCastingSkillEffects"/> dictionary. Acquire the <see cref="_activeCastingSkillEffectsSync"/> /// lock before calling this! /// </summary> /// <param name="key">The <see cref="Character"/> to remove the effects for.</param> static void RemoveFromActiveCastingSkillEffects(Character key) { List<ITemporaryMapEffect> value; if (!_activeCastingSkillEffects.TryGetValue(key, out value)) { // They were not in the dictionary return; } // Remove from the dictionary _activeCastingSkillEffects.Remove(key); // Kill each effect foreach (var fx in value) { fx.Kill(false); } }
/// <summary> /// An event callback for <see cref="Character.IsCastingSkillChanged"/> for the /// the <see cref="AD_CastingSkill"/> <see cref="ActionDisplay"/> script. /// </summary> /// <param name="sender">The <see cref="Character"/> who's <see cref="Character.IsCastingSkillChanged"/> event /// was invoked.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> static void AD_CastingSkill_Character_IsCastingSkillChanged(Character sender, EventArgs e) { Debug.Assert(sender.IsCastingSkill == false); // Remove the event hook sender.IsCastingSkillChanged -= AD_CastingSkill_Character_IsCastingSkillChanged; // Remove their active effects for casting skills lock (_activeCastingSkillEffectsSync) { RemoveFromActiveCastingSkillEffects(sender); } }