How kerazli/dreamofthekingdom works
Main Components
a. Game Core / Engine – The entire project is built on Unity, so the Unity runtime and its inherent game loop serve as the overall framework.
b. Game Data and Configuration – Managed via the “Assets/GameData” folder (including CardData, CardEffect, Enemy, Events, Map, RoomData, TurnBase, Variable, etc.) along with ScriptableObject definitions in the “Assets/Scripts/Cards/ScriptObject” and related directories.
c. Card System – Located in the “Assets/Scripts/Cards” directory (both MonoBehaviour implementations and ScriptableObject assets). This includes the card definitions, deck management, drag handlers, and UI interactions.
d. Character and Combat – Found in “Assets/Scripts/Character” (for Player, Enemy, and Boss behavior), “Assets/Scripts/EnemyAction,” etc. These manage combat logic, enemy patterns, animations, and other character-specific functionalities.
f. UI Management – The “Assets/Scripts/UI” folder holds panels for gameplay (GamePlayPanel, MenuPanel, GameOverPanel, PickCardPanel, etc.) as well as UXML and USS files under “Assets/UI” for the visual interface.
g. Event System – With “Assets/Scripts/Event” (and its Editor, MonoBehaviour, and ScriptObject components), the game implements an event-driven system (for things like card plays, character state changes, turn notifications, etc.).
h. Animation & Visual Effects – Several directories (Assets/M STUDIO, Assets/Spine, Assets/Plugins/Demigiant/DOTween, and TextMesh Pro) support sophisticated animations, spine rigging, tweening animations, and UI text rendering. This forms the bridge between gameplay events and visual representation.
i. Addressable/Asset Management – The “Assets/AddressableAssetsData” organizes assets that can be dynamically loaded or updated, supporting efficient asset management at runtime.
j. Plugins and External Tools – Integration of DOTween, Spine (for skeletal animations), and TextMesh Pro enhance performance and visuals.
Relationships and Interactions
– The central Game Manager (in Assets/Scripts/Manager/GameManager.cs) coordinates overall game flow and communicates with component managers (CardManager, SceneLoadManager, CardLayoutManager, UIManager, etc.).
– The Card System interacts with the UI panels (via PickCardPanel, CardDragHandler) and the Game Data (ScriptableObjects storing card stats and effects) to deliver gameplay.
– The Character and Enemy modules work in tandem with the Event System: character actions trigger events (e.g., new turn events, damage calculations) that are logged and resolved by associated listeners.
– The Room/Map generator connects to the SceneLoadManager to transition between different game states and rooms.
– The Animation and Visual Effects components (using DOTween, Spine assets) are triggered by both the card and character systems to provide visual feedback.
– Asset and Addressable management ensure that resources like card art, animations, and UI assets are loaded efficiently.
Architectural Patterns and Design Principles
– Component-Based Design: Using Unity’s MonoBehaviour and ScriptableObjects to isolate logic (for cards, characters, events) helps in modularization.
– Event-Driven Architecture: The event system (with BaseEventListener and EventSO based components) decouples the triggers from responses.
– Manager Pattern: Centralized managers (GameManager, SceneLoadManager, CardManager, etc.) orchestrate interactions across components.
– Data-Driven Design: Extensive use of data assets (ScriptableObjects for CardData, RoomData, MapConfigSO, EnemyActionData, etc.) implies that many game rules and configurations are configurable without code changes.
– Use of External Libraries/Plugins to extend functionality (DOTween for animation tweening, Spine for skeletal animation, TextMesh Pro for UI text, etc.).
Detailed Element Inclusions
• “Game Manager” triggering events to “UI Manager” and “Animation Controller”.
• “Card Manager” interfacing with “Player Input” (UI) and “Game Data”.
• “Map/Room Generator” feeding data to the “SceneLoadManager”.
– Additionally, include configuration nodes (such as AddressableAssetsData and ProjectSettings) to show how assets and settings integrate with the runtime.