Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

feat: Define and manage Event system #5

@Bli-AIk

Description

@Bli-AIk

🔗 Is your feature request related to a specific issue?

Communication between different game systems is often implemented via direct method calls or hard references. This creates high coupling, making it difficult to add or remove systems without breaking existing code.


💡 Feature Description

Implement a global, decoupled event bus (or message bus) system.

  • Expected outcome or effect: Asynchronous communication between modules via broadcasting and listening for events, without requiring direct references.
  • Specific implementation ideas: The following definitions are for reference only and are subject to change. Implementation could include:
    • A central EventBus or EventManager class.
    • Subscribe<TEvent>(handler) method to listen for a specific event type.
    • Unsubscribe<TEvent>(handler) method to stop listening.
    • Publish(eventInstance) method to broadcast an event to all subscribers.
    • Event types can be defined by simple C# classes or structs (e.g., PlayerDiedEvent, ItemCollectedEvent).
  • Usage scenarios or benefits:
    • The player health component can publish a PlayerDiedEvent when health reaches zero.
    • The UI, audio manager, and game state manager can all subscribe to this event to perform their respective actions (show "Game Over" screen, play death sound, save progress) without knowing about the health component itself.

⚖ Alternatives Considered

N/A


📝 Additional Information

N/A

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions