WEBVTT

00:07.000 --> 00:07.570
Okay.

00:07.570 --> 00:15.100
So now that we have an on overlap and an on end overlap function, we can decide whether or not to apply

00:15.100 --> 00:19.930
our various gameplay effects based on their application policy, right?

00:19.930 --> 00:23.380
So for the instant effect, we'll start with that one.

00:23.380 --> 00:30.070
It has its instant effect application policy and if it's set to do not apply well, we don't need to

00:30.070 --> 00:30.910
do anything.

00:30.910 --> 00:37.330
But if it's set to apply on overlap, we need to apply that effect in our on overlap function.

00:37.330 --> 00:41.410
And if it's set to apply on end overlap, we'll apply it then.

00:41.500 --> 00:46.600
So let's check this application policy in our on overlap function first.

00:46.690 --> 00:58.660
So here in on overlap, let's say if instant effect application policy is equal to e effect application

00:58.660 --> 01:05.440
policy, apply on overlap, then we can apply the instant effect to the target.

01:05.440 --> 01:07.640
So we have apply effect to target.

01:07.670 --> 01:16.460
We can call that we can call apply effect to target passing in the target actor and for the effect we

01:16.460 --> 01:20.450
can use the instant gameplay effect class.

01:20.450 --> 01:26.210
And if we set this to apply on overlap, we'd better be sure that our gameplay effect class is set.

01:26.240 --> 01:29.000
Otherwise we'll get a crash thanks to that check.

01:29.000 --> 01:32.390
So that's just something that we need to keep in mind.

01:32.690 --> 01:39.800
We can't set this to an incompatible enum constant if we don't have an instant effect to apply.

01:39.830 --> 01:45.740
Now, what if our instant effect has its policies set to apply on end overlap?

01:45.740 --> 01:50.180
Well, then we do it here so we can place a check and end overlap.

01:50.180 --> 02:00.860
If instant effect application policy equals e effect, application policy apply on end overlap, then

02:00.860 --> 02:09.140
we can call apply effect to target passing in the instant gameplay effect class so that takes care of

02:09.140 --> 02:11.120
applying our instant effect.

02:11.120 --> 02:14.330
And that's the most simple case.

02:14.330 --> 02:22.040
Now the next effect duration policy would be duration effect because a duration effect removes itself.

02:22.040 --> 02:26.060
We don't have to check its removal policy or anything like that.

02:26.090 --> 02:34.160
We just need to check its application policy and we can simply apply the effect here in on overlap or

02:34.160 --> 02:36.260
end overlap based on its policy.

02:36.260 --> 02:39.080
So we can check that just like we did for the instant effect.

02:39.080 --> 02:47.660
We're going to say if duration effect application policy equals and we'll check if it's apply on overlap.

02:48.080 --> 02:57.980
And if it is, we'll call apply effect to target passing in target actor and this time the duration

02:57.980 --> 02:59.480
gameplay effect class.

02:59.870 --> 03:08.180
We'll do the same exact thing and end overlap if the effect application policy this time is apply on

03:08.180 --> 03:09.260
end overlap.

03:09.260 --> 03:13.430
So that case is just about as simple as the instant effect.

03:13.460 --> 03:16.070
We apply it and it removes itself.

03:16.070 --> 03:26.090
Now the more complicated case is the infinite effect because the infinite effect can be removed and

03:26.090 --> 03:33.170
we want to remove the infinite effect on end overlap if we've given it to the actor in question.

03:33.170 --> 03:35.600
So how do we remove the effect?

03:35.660 --> 03:40.790
How do we know on end overlap that that actor has the effect?

03:40.880 --> 03:43.700
How do we check that and how do we remove it?

03:43.850 --> 03:47.780
Well, let's go back to our code for apply effect to target.

03:47.810 --> 03:49.790
How are we applying the effect?

03:49.820 --> 03:52.850
We're first making an effect context.

03:52.880 --> 03:59.480
We're using the effect context handle and the gameplay effect class to make an outgoing spec that gives

03:59.480 --> 04:00.770
us a spec handle.

04:00.770 --> 04:06.710
Then we apply that gameplay effect spec getting the spec from the handle dereferencing the pointer and

04:06.710 --> 04:07.880
passing that in.

04:07.880 --> 04:14.450
So the question arises how do we remove the effect once we've already added it and we'll handle that

04:14.450 --> 04:15.950
in the next video?
