Skip to content

Conversation

@MK-codes365
Copy link
Contributor

Issue:#132

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

@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 MK-codes365 force-pushed the feature/issue-132-combat-system branch from 3f43f21 to 4a3078c Compare January 17, 2026 20:36
@aadyagupta23
Copy link
Collaborator

@MK-codes365 console logs are not showing for me, the playerhealth script is also not attached to the player and the animator doesn't show me punch and death.

@MK-codes365
Copy link
Contributor Author

Okay wait let me check should I give you a screenshot while testing in unity ?

@aadyagupta23
Copy link
Collaborator

yess

@aadyagupta23
Copy link
Collaborator

@MK-codes365 if you don't make any changes soon I'll be assigning this issue to the next contributor

@MK-codes365
Copy link
Contributor Author

@aadyagupta23 sorry can you give me time till 4 am ?

@aadyagupta23
Copy link
Collaborator

you have time till tomorrow noon dw

@MK-codes365
Copy link
Contributor Author

@aadyagupta23 thanks

…ita#132)

- Fixed compilation errors in Health.cs, Player.cs, and HealthBarUI.cs
- Implemented core health system with Damage and Death logic
- Added punch attack system with configurable cooldown and animation support
- Integrated real-time health bar UI updates
- Added 'K' key debug helper for damage testing
- Configured Animator triggers (Punch, Death) and physics constraints
@aadyagupta23
Copy link
Collaborator

@MK-codes365 this issue is now being assigned to next contributor

@MK-codes365
Copy link
Contributor Author

@aadyagupta23 i am just pushing the code it's done

@aadyagupta23
Copy link
Collaborator

aadyagupta23 commented Jan 21, 2026

alright but no extensions from next time, commit right now

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