Take card from sleeping guard
Objective: Trigger sleeping guard cutscene to take card and return to game.
To achieve this goal the Player, Darren, must approach the sleeping guard to trigger the cut scene. The cut scene is allowed to complete and the player is returned to the game. Use Grab_Cut_Scene_Zone to integrate the behavior of the Player with the Sleeping_Guard_Cutscene and Main Camera.
Use a box collider on Grab_Cut_Scene_Zone, shown below, to trigger the Sleeping_Guard_Cutscene.
The Grab_Cut_Scene_Zone needs the following components to work. Notably, the box collider with is trigger checked and Grab Key Card Activation C# script.
The code below shows the use of serialize fields to assign the variables for the cut scene, _grabCardCutScene, and the position for the main camera at the end of the cutscene, _cameraEndScene, which are assigned as shown above.
The Player already contains a rigidbody, so an OnTriggerEnter method is used to detect the collision. If the Player is the other collider then activate the cutscene, as shown below. To return to the game, a coroutine is called, InactivateCutScene.
The IEnumerator coroutine, InactivateCutScene, waits for 6 seconds or the length of the cutscene timeline, and inactivates the cutscene. The main camera position is set back to Camera_Five held in _cameraEndScene, which is the Camera_Progression_Angle nearest the Sleeping_Guard.