# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview Nox is a Unity RPG game with party-based gameplay. It uses Addressables for asset management, Newtonsoft JSON for serialization, and URP for rendering. ## Architecture ### Dual-Layer State Management The game uses two layers of state: - **Game States** (`IGameState`): Application-level flow — Splash → MainMenu → GameMode (PlayModeGameState) - **Play Modes** (`IPlayMode`): Gameplay-level modes within GameMode — Adventure, Town, Rest, Combat, PauseMenu `PlayModeGameState` bridges these layers, managing play mode transitions and scene loading via Addressables. ### Key Subsystems - **Boot/Entry**: `Boot.cs` → `EntryPoint.cs` → `GameStateRunner.cs` (main update loop) - **GameData**: Global state container holding party, map, settings, and current play mode - **Platform Abstraction**: `IPlatform` with Desktop and UnityEditor implementations, selecting input mode and settings per platform - **Persistence**: `GamePersistenceController` + `IPlayModeStateSerializer` for JSON save/load - **Character System**: Attributes (Might, Reflex, Knowledge) → derived Stats (Health, Stamina), with Perks and party Roles (Protagonist + Companions) ### Namespace Convention Namespaces mirror the folder structure: `Nox.Core`, `Nox.Game`, `Nox.Input`, `Nox.Platform`, `Nox.Util`. ## Code Layout ``` Assets/Code/ ├── Core/ # Game states, bootstrapping, GameData, GameStateRunner ├── Game/ # Gameplay: PlayModes/, Camera/, movement, persistence, factories ├── Platform/ # IPlatform, DesktopPlatform, UnityEditorPlatform ├── Input/ # IInput abstraction with Desktop/Editor implementations ├── UI/ # Menu views and MonoBehaviour references └── Util/ # BootMode, editor utilities ``` ## C# Style (from .editorconfig) - 4 spaces, LF line endings - **No `var`** — use explicit types (`csharp_style_var_*: false`) - **No space after keywords** in control flow (`if(`, `for(`, not `if (`) - **Opening braces on same line** (`csharp_new_line_before_open_brace = none`) - Block-scoped namespaces (`namespace Foo { ... }`) - Always use braces (`csharp_prefer_braces = true`) - Naming: PascalCase for types/methods/properties, camelCase for all fields (public and private), `I` prefix for interfaces - Expression-bodied: yes for properties/accessors/indexers/lambdas, no for constructors/methods/operators ## Patterns - Constructor-based dependency injection (no DI container) - ScriptableObject-based configuration loaded via Addressables - Factory pattern for character/party creation - Action delegates for UI event communication