WEBVTT

00:06.930 --> 00:07.950
Welcome back.

00:07.950 --> 00:14.010
Now in this video, we're concerned with making a new interface, one that any actor can implement if

00:14.010 --> 00:17.190
we'd like to be able to highlight it when hovering over it.

00:17.610 --> 00:25.500
So for that, let's go to our C plus plus classes, Aura Public, and we'll go into interaction where

00:25.500 --> 00:26.970
we have our interfaces.

00:26.970 --> 00:29.010
We'll make a new interface here.

00:29.010 --> 00:32.880
So we'll scroll down to the bottom, make an unreal interface.

00:32.880 --> 00:36.450
And this can be our highlight interface.

00:37.620 --> 00:39.690
So we'll call it highlight interface.

00:40.020 --> 00:41.190
Create the class.

00:42.400 --> 00:43.900
And close the editor.

00:45.040 --> 00:49.720
Now the highlight interface is just going to have a couple of functions on it.

00:50.200 --> 00:51.850
So let's take a look at it.

00:51.850 --> 00:58.030
Here's highlight interface I'm going to open the header file though I almost accidentally moved something

00:58.030 --> 01:01.840
into another folder unintentionally but I canceled that.

01:01.840 --> 01:03.910
Here's highlight interface dot h.

01:03.910 --> 01:10.570
And let's get Combat Interface open as well so we can see what we've got in combat interface for highlighting

01:10.570 --> 01:11.710
and UN highlighting.

01:12.280 --> 01:14.290
Actually it's not in combat interface is it.

01:14.290 --> 01:15.790
It's an enemy interface.

01:15.790 --> 01:16.600
That's right.

01:16.600 --> 01:19.660
Enemy interface is actually kind of simple.

01:19.930 --> 01:26.650
It has highlight and unhighlight actor, but it also has set combat target and get combat target.

01:26.650 --> 01:28.390
So quite simple.

01:28.420 --> 01:31.360
Our highlight interface is going to be simple as well.

01:31.960 --> 01:36.910
Now as soon as we move these two functions into highlight interface, we're going to break something

01:36.910 --> 01:38.230
in the player controller.

01:38.230 --> 01:43.750
As the player controller is checking for the enemy interface when performing its cursor trace.

01:44.020 --> 01:45.910
So we are going to need to fix that.

01:46.360 --> 01:51.040
So what we can do is we can move these two functions with control X.

01:51.850 --> 01:55.210
Into highlight interface right here in the public section.

01:56.340 --> 01:59.310
And now we have to do a couple things.

01:59.310 --> 02:02.520
First of all, we need to go into the controller class.

02:02.520 --> 02:09.840
I went ahead and close aura dot h and let's go into the private folder, into player, into Aura player

02:09.840 --> 02:16.140
controller, where we're now going to see some red due to the interface that we're casting to in Cursor

02:16.140 --> 02:16.800
Trace.

02:17.430 --> 02:21.420
So what we're going to do is change what we're casting to here.

02:21.420 --> 02:25.320
From I enemy interface to I highlight interface.

02:25.320 --> 02:27.900
We can do that here I highlight.

02:29.490 --> 02:30.510
Interface.

02:31.170 --> 02:33.870
That's going to auto include that header file.

02:34.110 --> 02:38.010
But this actor and last actor are not highlight interface pointers.

02:38.010 --> 02:40.200
They're I enemy interface pointers.

02:40.200 --> 02:45.120
So we're going to need to change that to here in our player controller dot h.

02:45.120 --> 02:52.980
We're going to want to change last actor in this actor to I highlight interfaces.

02:54.810 --> 02:59.640
Now we're going to have a forward declaration here for I highlight interface.

03:00.360 --> 03:01.380
Like so.

03:01.620 --> 03:07.980
And if we search for AI enemy interface, we'll see that we don't actually need that forward declared

03:07.980 --> 03:09.720
here, so we can remove that.

03:10.020 --> 03:14.610
Now back in the cpp file, our last actor and this actor are.

03:14.610 --> 03:20.610
Now I highlight interfaces and we're calling highlight and Unhighlight on those actors.

03:21.000 --> 03:27.210
But the thing is they'll always be null because our enemies don't implement the highlight interface

03:27.210 --> 03:27.930
at all.

03:28.290 --> 03:31.410
What they implement is the enemy interface.

03:31.680 --> 03:35.820
So we have to implement the highlight interface in our enemies now.

03:36.060 --> 03:40.050
So what we can do is we can go to the character folder.

03:40.050 --> 03:42.240
I'd like to go to the public folder.

03:43.550 --> 03:45.320
And open Ora enemy.

03:46.610 --> 03:49.400
Where we have highlight and Unhighlight actor.

03:49.820 --> 03:52.220
Now I don't want to remove the enemy interface.

03:52.220 --> 03:53.870
Enemies need to implement that.

03:53.870 --> 03:58.610
I just want to add an additional interface we're going to implement.

03:58.610 --> 04:05.060
I highlight interface now, and that does require the header file for the highlight interface included.

04:05.420 --> 04:11.120
And now these functions are overriding the highlight interface virtual functions.

04:11.120 --> 04:15.800
So we can change this comment to say highlight interface instead.

04:17.920 --> 04:21.730
Now with that, we should still get the same exact behavior.

04:22.210 --> 04:27.760
We can hit debug and just test things out to make sure that everything works the same way.

04:30.600 --> 04:32.130
Okay, so we're back.

04:32.130 --> 04:40.650
I think I'm done with my post process highlight material now this enemy still starts off highlighted

04:40.650 --> 04:47.640
as ten, and that's because I set its custom depth stencil value in its details panel.

04:47.640 --> 04:52.170
If we want to get rid of that, we're going to need to change that back.

04:54.910 --> 05:00.580
So what I can do is set this value to zero and uncheck Render Custom Depth pass.

05:01.260 --> 05:02.790
That's going to fix that.

05:02.790 --> 05:08.850
And now if I press play, it's not highlighted, but it's still highlights because it implements the

05:08.850 --> 05:09.660
highlight interface.

05:09.660 --> 05:10.170
Now.

05:10.800 --> 05:15.630
Now this is great because now we don't have to just have enemies be highlighted.

05:15.630 --> 05:18.930
We can have anything else implement the highlight interface.

05:18.930 --> 05:23.910
As long as they implement highlight and unhighlight we should be able to highlight them.

05:24.660 --> 05:30.900
The problem is though, if we hover over a highlight interface and we click, as long as we have abilities

05:30.900 --> 05:33.540
which loading in without loading from disk.

05:33.540 --> 05:41.610
Now I don't get those abilities, but if I did, I would cast that spell assigned to my left mouse button

05:41.610 --> 05:44.430
when highlighting over a highlight interface.

05:44.520 --> 05:46.740
That's because our code is all the same.

05:46.740 --> 05:49.440
We get the same behavior in the player controller.

05:49.440 --> 05:56.370
When we left click, we have ability input tag pressed and released which check whether or not we're

05:56.370 --> 05:57.300
highlighting.

05:57.300 --> 06:05.160
We have a boolean called targeting, which is set to true if this actor is valid, false if not, and

06:05.160 --> 06:10.470
that actor is null or not based on casting to the highlight interface.

06:10.770 --> 06:17.130
So if we want to be able to highlight something without this property of left clicking and casting a

06:17.130 --> 06:24.480
spell targeting it, well, we're going to need to make a couple changes to the player controller and

06:24.480 --> 06:30.330
have the ability of knowing that whatever we're highlighting is an enemy or not an enemy.

06:30.750 --> 06:33.540
So we're going to focus on doing that next.

06:33.540 --> 06:38.820
We'll have some changes to make to the player controller so that we can highlight a non enemy.

06:38.820 --> 06:44.700
And if we click on it, we don't get the behavior of casting a spell targeting it.

06:44.700 --> 06:46.140
So we'll do that next.

06:46.560 --> 06:47.460
I'll see you soon.
