Skip to content

Refactor/architecture and player#1

Closed
dacrab wants to merge 22 commits intomainfrom
refactor/architecture-and-player
Closed

Refactor/architecture and player#1
dacrab wants to merge 22 commits intomainfrom
refactor/architecture-and-player

Conversation

@dacrab
Copy link
Copy Markdown
Owner

@dacrab dacrab commented Dec 24, 2025

No description provided.

dacrab and others added 22 commits November 19, 2025 22:21
- Health: Decoupled Healthbar using EventBus
- Combat: Created ProjectileBase, standardized Player/Enemy projectiles
- NPC: Standardized Input (Legacy), use GameConstants
- Traps: Updated Falling/Sticky platforms to use GameConstants
- Cleanup: Removed redundant EnemyFireballHolder
- PowerUps: Updated to use PlayerPowerups component and PlayerMovement facade
- Menus: Menu/Loading/UI Managers updated to use EventBus, Constants, and SaveSystem
- Parallax: Consolidated logic into ParallaxBackground (deleted MenuParallax)
- Doors: Modernized with GameConstants
- Restructure scripts into Core, Gameplay, Environment, and UI domains
- Update namespaces across all scripts to match new folder structure
- Migrate PlayerMovement to PlayerController and PlayerLocomotion
- Consolidate game logic in GameManager and LoadingManager
- Modernize UI and Sound systems with event-driven architecture
- Remove legacy and redundant code/folders
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…dling

- Added REFACTOR_REPAIR_GUIDE.md with instructions to fix broken script references in Scene/Prefabs.
- Updated Health.cs to provide actionable error messages when PlayerController is missing.
- Included Unity 6000 TextMesh Pro shader updates.
- Add IDamageable interface for unified damage handling
- Add PlayerReference utility for cached player lookups
- Add ServiceLocator pattern for dependency management
- Add TalkableNPC base class consolidating NPC dialogue
- Convert coroutines to UniTask async/await patterns
- Standardize singleton pattern (PascalCase Instance)
- Remove unused GameInput stub class
- Fix Health namespace/class collision issues
- Clean up verbose regions and redundant code
- Add UniTask package for modern async patterns

~800 lines removed while improving code organization

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Fix PlayerMovement reference in PowerUpBase.cs (removed deprecated fallback)
- Update SoundManager.Instance to SoundManager.instance (lowercase singleton)
- Fix Health namespace conflicts by using fully qualified names
- Add UI.Menus namespace for LoadingManager in MagicStone.cs
- Comment out unused ResumeEvent in InputReader.cs
- Update deprecated unityBackgroundScaleMode to backgroundSize API
- Migrate TreeView classes to generic versions (TreeView<int>, TreeViewItem<int>, TreeViewState<int>)
…ement missing methods

- Add Collider2D extension methods for TryGetHealth and TryGetPlayerController
- Fix SpriteRenderer.SetEnabled() to use enabled property directly
- Implement missing SpawnParticles method in Health.cs
- Fix Vector2 + Vector3 ambiguity in ParallaxBackground
- Fix IObjectPool CountActive/CountInactive with safe casting
- Add proper using directives throughout codebase
- Detailed analysis of 77 scripts across 4 main directories
- Identified strengths: modern Unity patterns, clean architecture, excellent expandability
- Identified improvements: empty folders/files, minor organizational decisions
- Overall grade: A- (Excellent with minor cleanup needed)
- Action items provided for immediate and future improvements
Priority 1 Actions Completed:
- Delete empty Core/Architecture folder
- Improve NPC wrapper classes (Emberon, Lumina, Wraith) with proper XML documentation
- Verify UI/Dialogue/SOs folder contains asset files (not empty)

Changes:
- Removed empty Architecture folder and meta file
- Added comprehensive XML documentation to NPC classes explaining their purpose
- Updated STRUCTURE_REVIEW.md to reflect completed actions
- All Priority 1 cleanup items resolved
- Deleted STRUCTURE_REVIEW.md (temporary review document)
- All Priority 1 improvements completed
- Codebase is production-ready
Features:
- AutoWireAttribute with 7 wire types (Self, Parent, Children, Scene, Service, Player, Tagged)
- AutoWireHelper for runtime automatic wiring
- AutoWireComponent base class for automatic wiring
- Editor tools: Auto-Wire Selected/All in Scene menu items
- Custom property drawer with auto-wire button in Inspector
- Example usage file demonstrating all patterns

Benefits:
- Eliminates manual Inspector dragging for common references
- Reduces setup time significantly
- Works with ServiceLocator, PlayerReference, and FindObjectOfType
- Editor tools for batch operations

Updated examples:
- MagicStone: Auto-wires UIManager and SpriteRenderer
- UIManager: Auto-wires PlayerController via PlayerReference
- Add Core.Utilities using to UIManager.cs
- Add UI.Managers using to AutoWireExamples.cs
- All compilation errors resolved
- Change constraint from 'where T : class' to 'where T : Object'
- Fixes CS0311 error with FindFirstObjectByType<T>()
- Removed unused Player State Machine (8 files)
- Removed AutoWireExamples.cs demo file
- Moved IDamageable to Core/Interfaces for consistency
- Moved Stats ScriptableObjects to Core/Data/Stats/
- Removed unused IInitializable interface

AutoWire System:
- Applied AutoWire to 16+ files for automatic component wiring
- Eliminated manual Inspector reference assignments
- Added AutoWire to PlayerController, PlayerLocomotion, PlayerPowerups
- Added AutoWire to EnemyBase, MeleeEnemy, RangedEnemy
- Added AutoWire to PowerUpBase, ProjectileBase, Health
- Added AutoWire to LoadingManager, TalkableNPC, PlayerRespawn
- Added AutoWire to VolumeText, ParallaxBackground

New Utility Systems:
- CoroutineExtensions: Safe coroutine stopping (prevents null errors)
- CooldownHelper: Type-safe cooldown timer API (replaces Mathf.Infinity)
- TagHelpers: Cleaner tag comparison extensions
- ValidationHelpers: Common validation patterns

Code Quality Improvements:
- Replaced Mathf.Infinity cooldown pattern with CooldownTimer (3 files)
- Applied SafeStopCoroutine to PowerUpBase
- Fixed duplicate field names (attackCooldown vs attackCooldownDuration)
- Removed redundant GetComponent calls after AutoWire
- Removed unused ResetProjectile method
- Cleaned up redundant InitializeComponents methods

Documentation:
- Updated README.md with AutoWire documentation
- Expanded architecture section with full folder structure
- Added code examples and development guidelines

All changes compile with zero errors.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 24, 2025

Important

Review skipped

Too many files!

145 files out of 295 files are above the max files limit of 150.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/architecture-and-player

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dacrab dacrab closed this Jan 8, 2026
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.

1 participant