Today’s development was about bringing some of the elements that I’ve already implemented together.
First the GUI, previously the GUI would display when the player picked up the flashlight, which paused the player and unlocked the mouse cursor so they could read the information about the item and then click the close button to continue. However, the close button hadn’t been wired up so that was my first job. This involved learning more about interacting between different game objects and sending messages to them, but also working in both UnityScript and C#.
The second aspect I wanted to sort out was to block the player from proceeding down a corridor that is deliberately pitch black if they don’t have the flashlight yet. It’s very easy to create an invisible barrier but I had to learn about the controller collider in order to find out if the player had hit the barrier, and then if they had a flashlight that would allow them to see further. This aspect was a little more confusing than I expected. I incorrectly assumed that the OnCollisionEnter() would work here, but after some scratching off the head I discovered that because I was after information from the CharacterController I needed to use the OnControllerColliderHit() event handler instead. Once that had been swapped in it was plain sailing. The player would now stop when attempting to go down the corridor (at which point a message and/or voice over would indicate that a flashlight was needed) or if the player had a flashlight the barrier would allow them through.
My next focus is going to be to reskin the UI so that it fits in with the game, then I can concentrate on more modelling. I will hopefully have some new screenshots for you next time as well.