This PR adds the basics of the player health system.
A player will start a new/reset game with 1 health.
All clothing items are set as 'false' at the start of the game
For clothing items that are equipped (bool == true), the health calculates accordingly
When the crow collides with the player, damage the player
If the player is wearing clothing items on crow collision, a random choice will be made and the clothing is removed
If player isnt wearing any clothes on collision, invoke the gameover event in GameManager.cs
Branch:
Devon/Player-HP
Fixes Issue:
9
Scene:
Scenes/Player Health
New player prefab linked in scene GameManager:
Prefabs/Player/Player (HEALTH)
Changes required in other PRs
Currently the only way to change the bools (increase health) is in the inspector window. Once we have the Clothing Pickup finished, it will need to set the bool to true when an item is picked up (e.g Hat picked up => playerHealth.hatWorn = true)
The Update method current runs the check for player health. I think it would be best to move this to when an item is picked up so that there is no potential impact to performance (i.e running CheckHealth() constantly currently vs running once on each pickup). The health will always be rechecked after the player takes damage so it displays accurately.
For clothing pickups there needs to be a function that can remove specific items from the player when damaged. Currently the bool is set to false and there is a comment where this would be called.
(e.g when damaged => randomly select clothing item => bool set to false and clothing removed from player)
Comments in the PlayerHealth script for what is required for it to function and where the future changes need to be:
Also as there is some repetitive but short code, I have made the if statements as single line statements to improve readability
Video Demonstration
Apologies for video resolution, had to compress file multiple times to fit on Github :)
Demo 1:
For the purpose of showing the random removal of clothing I have set the intitial game bools to all be true (4 health). The game only ends when all these bools are false and the player gets hit by the crow again
Demo 2:
Game 1: shows the tracked health value and what happens with enabling and disabling bools during runtime.
Game 2: shows that health starts at 1 on a new game/reset
Description:
This PR adds the basics of the player health system.
Branch:
Devon/Player-HP
Fixes Issue:
9
Scene:
Scenes/Player Health
New player prefab linked in scene GameManager:
Prefabs/Player/Player (HEALTH)
Changes required in other PRs
Comments in the PlayerHealth script for what is required for it to function and where the future changes need to be:
Also as there is some repetitive but short code, I have made the if statements as single line statements to improve readability
Video Demonstration
Apologies for video resolution, had to compress file multiple times to fit on Github :)
Demo 1: For the purpose of showing the random removal of clothing I have set the intitial game bools to all be true (4 health). The game only ends when all these bools are false and the player gets hit by the crow again
https://github.com/LiamMcKenzie/ScaredKrow/assets/90590089/4e6c568f-6fad-40ca-8ee0-7dc33834be32
Demo 2: Game 1: shows the tracked health value and what happens with enabling and disabling bools during runtime. Game 2: shows that health starts at 1 on a new game/reset
https://github.com/LiamMcKenzie/ScaredKrow/assets/90590089/a390bfc9-c0d3-4dbe-b3bb-01d902f86cbb