[MUSIC] Hi everyone. I'm Jeremy Gibson Bond, and welcome back. In this video, we are going to be looking at the alert mode challenge. Now, of course the game already moves into alert mode, but right now, all it does is print a little message to the screen. What we're going to do now is make several graphical changes and one AI change whenever the game goes into alert mode. Let's take a look at how it's going to look when you're done. Okay, so here we are back in the game. You'll notice that I've added these logos, these company logos that come from the adventure tutorial that Unity has in the Asset Store. But everything looks the same until I trigger the alarm. Now, everything turns red. It says warning intruder, the enemy starts chasing after me, and all of these changes are things that you are going to make as part of these rascal changes. Now, you'll notice the reflection probes don't change. That's okay, don't worry about that here. Everything else is changing and it should be sufficient. Now, in addition to going into alert mode, you also need to be able to cleanly exit alert mode. You'll see here that when I turn off the test alert trigger, everything goes back to normal. Now, she's going to get hit by in the arm right there immediately. But everything goes back to normal all the waiting changes goes back. And it's really important, because that allows us to rest everything and turn a little on and off without having to go back and stop the gaming. Now, all of these move stuff is code that I've placed under the alert mode folder. You'll see the alert mode manager in there is the one that you already have. There's no changes to that. The new things are the other scripts. So let's just go down one by one and talk about what they do. The alert mode ambient light modifier you can see it here in the inspector as well. This just changes the ambient light of the scene from the bluish color that we had, that you can see here in lighting, to this more yellowish color. And that's because that blue color didn't really contrast well with the red when we go to alert mode. And I want something kind of make stuff pop-out a little bit. The alert mode color modifier here actually allows us to change a specific named color parameter on a shader. You can see here in the inspector I'm using it to change the emissive color of the walls from this cyan color to a red color. Now, you can see that I know it's named _emissioncolor. Normally, when you look at a shader, that's going to be listed when you select the shader. However, because this is the Unity standard shader and it's not actually living in my project folder, I had to find that name in the documentation and then test it. However, the cool thing about this alert mode color modifier is that it could be used to change any color parameter and any shader, which makes it very powerful. Up next is the enemy state modifier. Now, this one you can see in the Inspector, does not have any parameters. I'm just using it to set the enemy into chase mode or out of chase mode. So it's pretty straightforward and I've gone ahead and added the code for chase mode to the enemy for you. So you don't need to do that. You just need to switch into and out of it. The alert mode light cone modifier modifies the color of a light cone, of that sort of projected light cone. It also modifies the color of the light that that cone is surrounding. This alert mode light cone modifier script is actually attached at the top level to the root of both the security camera and the enemy. And what it does is it gets components in children looking for light tone components. And then makes a list of those and it affects everyone of them in the list, and then we'll switch them back to the original color when we leave alert mode. The last one here is the alert mode's right modifier. Now, this does two things. One, it changes the Sprite's color. And two, it actually changes the Sprite image. And we're switching from this camping logo to intruder alert, which you can find by searching in the project folder, but it is here if you go looking for it. So the way that these kind of company logo holograms work, this neat effect that they came up with in the adventure tutorial, is there is a red, a green, and a blue layer, and they are additively multiplied. So when you put them together, they look white, but they kind of have an animation that glitches them out from each other and there is this nice color difference. Now, if I changed all of those to the same red, we'd lose that neat effect. So by changing them to 70% red, there's still just a little difference between them. I'm actually blending between the original red, green, or blue color, and the new red color to get a little bit of kind of purpling and greening whenever it shifts out of phase which I really like. So now that we've taken a look at what it's going to look like when you're done, let's jump into the challenge project. And we'll see what I put together for you. So first of all, I just made this folder to hold all these alert mode scripts. But that's most of what you're going to be doing, is writing scripts. I've gone into the Enemy nav already and I've added the chase and stop chasing behavior. So you don't need to worry about that. You just need to set them with the script that you create. I have also gone in and added all these company logos around. Now, because we don't have hierarchical prefabs, you will need to go into each one of the logos and add the script that you create to each one of them. Or, write a script that looks for each one of them under the hallway. However, if you ever added other things, they were Sprites, because my script, all it does is look for Sprites. It might grab some Sprites you do not intend to grab. So I recommend adding the script to each one of the companies logo hologram holders. So that's it for this challenge. I hope you have fun with it and I hope you like getting back to coding. I'll see you in the next video. [MUSIC]