Monday, March 18, 2019

Week 26 + 27

Week 26 + 27:

Creating An Enemy NPC - Part 6

Due to working on working on the Enemy NPC for the last few weeks and working on my other course’s assignments, I have decided I’ll give this one a few more weeks and then move onto the other things I want to add into my Unity Week. This week, I shall be adding the “Death Animation” for when the “Monster” catches the “Player” character.


In order to do this, I began by going into the “Monster” script and added the following coding as seen above in the following place. Afterwards, I then went to “Create” > “Camera” and then placed the “Camera” inside of the “Monster”.  I then renamed it from “Camera” to “DeathCam”. I then re-positioned the first-person camera to the “Monster”.


With the “DeathCam” selected, I then went into “Game Object” > “Align With View” and that moved the “Death Camera” to the exact same position as our viewer. After that, in the “Depth” options I gave the “FirstPersonCharacter” a depth of “0” and the “DeathCam” a depth of “1”, so that it’s now in front of it and that is overwrites it now.


I then grabbed the “Spotlight” from “FirstPersonCharacter” and then I duplicated it, before placing it into “Monster”. I then clicked the “Reset” button for the duplicated “Spotlight. In the “DeathCam”, I then edited the “Clipping Planes” to “0.1” because it’ll be animated soon. Once I finished that, I then clicked “Create” and created a new “Empty”.


Afterwards, I then renamed this “CamPos”. I then clicked on the “DeathCam” and then the “Gear” button, and then clicked on the “Copy Component” option. Then in “CamPos”, I clicked the “Gear” button and then I clicked on “Paste Component Values”. Now its position is exactly the same as the positions that the “DeathCam” positions has.


For this animation, I now want the camera to pan into the face of the “Monster” when they have caught the “Player”. To do this, I began by disabling the “DeathCam” and then on the “Monster” I dragged the “DeathCam” onto it. After this, I then went into the “FirstPersonCharacter” script and then I copied the following line. And then going into the “Monster” script I added the following lines.



Basically, this means when the "Player" gets caught they'll be disabled and be unable to move when the "Monster" catches them, and the "Camera" then pans around to them. Additionally, when the "Player" is caught the "Monster" will also growl again but in a lower pitch this around and then the game will reset afterwards, using the “Kill” script in “Monster”.


No comments:

Post a Comment

Week 34

Week 34: Critical Reflection: Conclusion: Over the course of this college year, I have managed to design, create and test my Horror-ba...