protected override void OnAuraExit(Collider other) { CourageEffect component = GetEffectFromCollider(other); if (component) { component.RemoveEffect(); } appliedEffects.Remove(other); }
CourageEffect GetEffectFromCollider(Collider other) { CourageEffect component = null; if (!appliedEffects.TryGetValue(other, out component)) { component = other.gameObject.GetComponent <CourageEffect>(); if (!component) { component = other.gameObject.AddComponent <CourageEffect>(); } appliedEffects[other] = component; } return(component); }