How to make explosions damage a character only once?

airoll

Member
Before UCC3, I had a rocket launcher that on impact, creates an impact prefab with an Explosion script attached to it. Even if the explosion hit multiple colliders on the same character, it would only apply the explosion damage once.

Now, with UCC3, my explosion is causing multiple impacts to be applied. In fact, when I debug Explosion.Explode(...), I get 11 hits, which correspond to different colliders on the body of my character. This results in 11 applications of the damage effect.

Is there any way to make it such that an explosion only affects a character once in UCC3?
 
Following up here, it looks like the reason this worked in UCC2 is that CharacterLocomotion used to implement IForceObject, but in UCC3 it does not. That causes this section of code to effectively fail in checking that hit colliders share the same parent character.

C#:
// The base character GameObject should only be checked once.
if ((forceObject = hitCollider.gameObject.GetCachedParentComponent<IForceObject>()) != null) {
    if (m_ObjectExplosions.Contains(forceObject)) {
        continue;
    }
    m_ObjectExplosions.Add(forceObject);
}

What would be the recommended fix here? Replace IForceObject with ICharacter?
 
Top