コード例 #1
0
    protected override void OnAuraExit(Collider other)
    {
        CourageEffect component = GetEffectFromCollider(other);

        if (component)
        {
            component.RemoveEffect();
        }
        appliedEffects.Remove(other);
    }
コード例 #2
0
    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);
    }