Hi, everyone. I'm Jeremy Gibson Bond, and welcome back to the Unity Certified Programmer exam preparation course. In this video, we're going to be looking at the solution to the alert mode challenge. Now, I showed you most of the structure in the challenge video. So, I'm really going to be going into the individual pieces and looking at how they work. As a reminder, here in the Alert Mode Manager, we have this alert mode status change delegate that gets called anytime the alert mode changes. Anytime it becomes newly true, or newly false. So, we need to register all of these things with that delegate which I'm sure you did. Let's start by taking a look at one of the simplest. You can see here the alert mode ambient light modifier, which has an inscribed colour that we will switch to and a dynamic colour which is set when the script starts, that just holds the value of the original ambient light colour. At the top of the script, we have those fields and then we have a start method which gets that original colour, registers, for the delegate and then sets inited to true. On Destroy, we de-register and that's critically important otherwise we have the random pointers, two methods just lying around there in the delegate that we don't want. On alert mode status change, we get past the new alert mode and we act on it by setting our colour to either the new colour or the old colour based on weather alert mode is true or false. You'll see the same pattern in lots of these. Now, you'll note that I did not create a superclass for all of these, the sort of like an alert mode handler or something like that that would enforce them all having the same name of the function, the alert mode status change method. That's because they don't have to be the same name. Now, you could certainly do that and it might help you organize your code better. But, because we are passing the method itself to the delegate, we are adding it to the delegate, it doesn't actually matter what the name of the method is as long as it fits the pattern of the delegate. As long as it fits the same type and parameters that the delegate is. The next one we're going to look at is the colour modifier on the hallway walls. You can see in the script that because I'm dealing with a material element number and a parameter name that anyone can put in, I'm checking them and making sure that there is a material in that material element number and I'm making sure that it has a parameter of the name emission colour. So, I do both of these checks before I try to pull the original colour out of the shader. The alert mode enemy state modifier is really pretty straightforward fits on less than a screen and you'll see that all it does is it sets the enemy mode to either chase or stopped chase based upon when it gets the alert mode call. Next up, let's take a look at the alert mode light-cone modifier. As I mentioned in the challenge, this sits at the root level and dives deep down using Git components and children to find all of the light cones attached to an object. Now, this is a slow call but only happens once whenever the object is instantiated, so that's probably okay. It's not like it's happening every frame. This one works pretty similarly to the other ones. The only real difference here is this copy alpha from original. I thought since you just had tuned to everything so that the alpha of that light cone was said exactly the way you wanted it, you probably wouldn't want to set that in two places. So, I allow that checkbox to let you carry over that value from the original colour to the new colour. You can see here that it grabs all of the sprite renders that are children that's because with these holograms, we've got the three separate pains that all kind of go out of phase to each other. It grabs their individual colours and then, when we actually set the color, you can see down here that we're making use of that color blend value which ranges from zero to one to do a linear interpolation between the original colour and the colour to switch to, which is that bright red. The colour blend value being set to zero would just show the original colour. One would just show the bright red. I have found arranged around 0.7, gives me the effect I want where it's mostly red but the three panels are still slightly different from each other in colour and that way, you can see the glitching better. So, that's it for the alert mode solution, you can see that because we planned it out well. We were able to use very simple classes attached to a single delegate to handle the changes both to and from alert mode, which I think is a pretty good way to structure the code. I hope you enjoyed this challenge and I will see you in the next video. Thanks a lot.