-
Notifications
You must be signed in to change notification settings - Fork 67
feat : Implement player health system, setup death and punch animation #132 #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hey @MK-codes365 This is not a valid Issue Number. Kindly recheck it! |
|
Hey @MK-codes365 This pull request is not linked to open for all or competitive issues. Either check the PR number or get yourself assigned to work on this issue. Thanks for contributing in OpenCode'25 ✨✨! |
|
@aadyagupta23 i am so sorry for late submission it wont happen again please assign me i have workd on this for 4 days |
|
@aadyagupta23 you have unassigned me from this issue thats why i cant make any pull request for my commit |
|
you are currently assigned, I'll cross check the issue and let you know |
|
@aadyagupta23 sir I made a major mistake I have committed all the files of other contributors I haven't made the pull request so there won't be any issue on the repo right ? check my latest commit |
|
@aadyagupta23 did you checked ? |
|
@aadyagupta23 check this commit 97c0d12 |
|
Hey @MK-codes365 Thanks for opening this PR 🚀. Mentor will review your pull request soon and till then, keep contributing and stay calm. Thanks for contributing in OpenCode'25 ✨✨! |
|
@aadyagupta23 any update on my pr ? |
|
@aadyagupta23 you have to drag #health.cs and drop on the hero it will get added i tested on my system |
|
Hey @MK-codes365 Your PR has been merged 🥳🥳 and you have earned 50 points. Thanks for contributing in OpenCode'25✨✨ |

Issue: #132
Done
Implemented the core combat and survival foundation for the player. This includes a modular health system, a punch attack mechanic, real-time UI feedback, and complete death state handling.
Key Features:
Modular Health System:
PlayerHealth.cs handles life-cycle states: Max health initialization, damage clamping, and optimized death logic.
Uses UnityEvents (onHealthChanged, onDeath) for decoupled communication with other systems.
Combat System:
Implemented a TryPunch() mechanic in Player.cs utilizing the Mouse Left Button.
Includes a configurable punchCooldown to prevent spamming.
Attack logic is independent of movement, allowing for seamless combat feel.
Real-time UI Visuals:
HealthBarUI.cs provides instantaneous feedback for both health bar fill amount and text ratio (current / max).
Dynamically subscribes to health changes to minimize performance overhead.
Death Persistence:
On death, player inputs and physics velocities are automatically disabled.
Triggers the Death animation state exactly once.
Testing Tools (Internal):
Added a 'Debug Damage' helper mapped to the K key.
Applying damage via K correctly updates the UI and triggers death, facilitating easy verification without enemies.
Files Added/Modified:
Assets/_Project/Scripts/Player/Player.cs


Assets/_Project/Scripts/Player/PlayerHealth.cs
Assets/_Project/Scripts/UI/HealthBarUI.cs