Player-World Collision Bug
Issue: When the player navigates through a trap door, either to a floor higher or lower, the player sprite does not recover their collision with the world, hence they fall through the world.
Expected Behavior: As shown in the video, when the player navigates through a trap door, once they pass the trapdoor, the player sprite must collide with the world.
Cause: When the player navigates between floors, the player collider's IsTrigger flag is set to true, allowing the sprite to pass through the trapdoors,
and when the player collider leaves the trap door i.e., in the OnTriggerExit method, the player collider's IsTrigger is reset to false. However, the IsTrigger is not being reset as in some cases the OnTriggerExit was never being called.
Resolution: I realized through investigation, that the OnTriggerExit was not being fired sometimes and naturally leading to this bug. Fixed this by moving the player jump instigation to FixedUpdate instead of update, which ensured that the player jumped to the same height consistently as it was no longer framerate dependent and ensured that the player sprite passed through the trapdoor collider completely and consistently upon jumping. Therefore the OnTriggerExit fired everytime ensuring resolving this nagging issue.
Consistent State Transitions
Issue: When the player is caught by the a enemy while the player is either moving away from the enemy, or is navigating through the floors, the player object does not transition to "Caught" state, while the enemy continues to play the caught animation, and the level restarts after few seconds as it should.
This causes users to believe they escaped the enemy while they did not as the sprite continues to respond to input.
Expected Behavior: As shown in the video, the player object must immediately transition to the caught animation immediately irrespective of what they are currently doing, when caught by an enemy.
Cause: Each enemy instance, as well as the player instance individually detect if the player was caught in their respective OnCollisionEnter method. While the enemy script notifies the game state of the caught event, the player script was on it's own to detect when it was caught.
Resolution: I realized that, while the idea to make each object responsible for it's life-cycles is great, an event that effect the entire game state was better to be fired from one place, and let each object's handling of that event be their own responsibility.
Therefore, I refactored the code to notify the game manager of the caught event, regardless of which collider detects the event between the player and the enemy, and let the game manager broadcast the caught event to all objects with information on who is the catcher and who got caught, therefore the listening objects may properly transition to appropriate states.
Menu Navigation System
Implemented a simple menu navigation system. Going in with little to no knowledge of Unity, the menu system gave me a good opportunity to get familiarized with the engine.
With the limited available time in mind, we took the decision to have a simple straight forward menu.
Level Select/Unlock System
Upon completion on each level, the next level is unlocked in the level select menu.
The user can choose any of the unlocked levels to replay the level to better their score.
The level select menu shows the previous best score at the level. The video show all levels unlocked with best scores and level preview on the right.
The Magnificent Programmer Art
No words required here. Just enjoy the magnificence!
Oh alright, I will say a few words then. Since this was a school project, some expected guidelines were provided by the school and on of those guidelines was the end level screen.
Very late in development we realized we missed these, along with an options menu. At this point however, we had limited time left and our only artist has his plate full.
So it was time for some programmer art. I took it on my self to make some wonderful art, with hope that our artist would find some last minute time to tweak some bits. From the video, we I think we can all take an educated guess whether or not he found time.