Okay.
So now that we have an on overlap and an on end overlap function, we can decide whether or not to apply
our various gameplay effects based on their application policy, right?
So for the instant effect, we'll start with that one.
It has its instant effect application policy and if it's set to do not apply well, we don't need to
do anything.
But if it's set to apply on overlap, we need to apply that effect in our on overlap function.
And if it's set to apply on end overlap, we'll apply it then.
So let's check this application policy in our on overlap function first.
So here in on overlap, let's say if instant effect application policy is equal to e effect application
policy, apply on overlap, then we can apply the instant effect to the target.
So we have apply effect to target.
We can call that we can call apply effect to target passing in the target actor and for the effect we
can use the instant gameplay effect class.
And if we set this to apply on overlap, we'd better be sure that our gameplay effect class is set.
Otherwise we'll get a crash thanks to that check.
So that's just something that we need to keep in mind.
We can't set this to an incompatible enum constant if we don't have an instant effect to apply.
Now, what if our instant effect has its policies set to apply on end overlap?
Well, then we do it here so we can place a check and end overlap.
If instant effect application policy equals e effect, application policy apply on end overlap, then
we can call apply effect to target passing in the instant gameplay effect class so that takes care of
applying our instant effect.
And that's the most simple case.
Now the next effect duration policy would be duration effect because a duration effect removes itself.
We don't have to check its removal policy or anything like that.
We just need to check its application policy and we can simply apply the effect here in on overlap or
end overlap based on its policy.
So we can check that just like we did for the instant effect.
We're going to say if duration effect application policy equals and we'll check if it's apply on overlap.
And if it is, we'll call apply effect to target passing in target actor and this time the duration
gameplay effect class.
We'll do the same exact thing and end overlap if the effect application policy this time is apply on
end overlap.
So that case is just about as simple as the instant effect.
We apply it and it removes itself.
Now the more complicated case is the infinite effect because the infinite effect can be removed and
we want to remove the infinite effect on end overlap if we've given it to the actor in question.
So how do we remove the effect?
How do we know on end overlap that that actor has the effect?
How do we check that and how do we remove it?
Well, let's go back to our code for apply effect to target.
How are we applying the effect?
We're first making an effect context.
We're using the effect context handle and the gameplay effect class to make an outgoing spec that gives
us a spec handle.
Then we apply that gameplay effect spec getting the spec from the handle dereferencing the pointer and
passing that in.
So the question arises how do we remove the effect once we've already added it and we'll handle that
in the next video?