Skip to content

Conversation

@MK-codes365
Copy link
Contributor

@MK-codes365 MK-codes365 commented Jan 21, 2026

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
Screenshot 2026-01-21 154517
Screenshot 2026-01-21 154617

@OpenGitBot
Copy link

Hey @MK-codes365

This is not a valid Issue Number. Kindly recheck it!

@OpenGitBot
Copy link

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 ✨✨!

@MK-codes365
Copy link
Contributor Author

@aadyagupta23 i am so sorry for late submission it wont happen again please assign me i have workd on this for 4 days

@MK-codes365
Copy link
Contributor Author

@aadyagupta23 you have unassigned me from this issue thats why i cant make any pull request for my commit

@aadyagupta23
Copy link
Collaborator

you are currently assigned, I'll cross check the issue and let you know

@MK-codes365
Copy link
Contributor Author

MK-codes365 commented Jan 21, 2026

@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

@MK-codes365
Copy link
Contributor Author

@aadyagupta23 did you checked ?

@MK-codes365
Copy link
Contributor Author

@aadyagupta23 check this commit 97c0d12

@OpenGitBot
Copy link

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 ✨✨!

@MK-codes365
Copy link
Contributor Author

@aadyagupta23 any update on my pr ?

@aadyagupta23
Copy link
Collaborator

image

@MK-codes365
Copy link
Contributor Author

@aadyagupta23 you have to drag #health.cs and drop on the hero it will get added i tested on my system

@aadyagupta23 aadyagupta23 merged commit 11ba5b5 into opencodeiiita:main Jan 22, 2026
@OpenGitBot
Copy link

Hey @MK-codes365

Your PR has been merged 🥳🥳 and you have earned 50 points.

Thanks for contributing in OpenCode'25✨✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants