How ducknok/turnbased works
Project’s Core Components
• Unity Engine & Runtime: Represent the overall Unity engine that provides the underlying framework (rendering, physics, input, asset loading, etc.).
• Game Scenes: Highlight key scenes (found in the “Assets/Scenes” folder, e.g., “SampleScene.unity” and “Player”) that load and run the game.
• Input Management: Specify the “Assets/Input” folder where the InputManager and input actions (Control.inputactions) are defined. This drives player commands.
• Game Assets & Prefabs: Include a container for art and animations (Assets/Animation, Assets/Animator, Assets/Assets, Assets/Prefabs, Assets/Resources) that supply visual, UI, and interactive components.
• Game Logic & State Machines: Emphasize the game’s turn-based combat system with components from “Assets/Script”. For example, you have:
• CombatStateMachine (managing overall turn-based flow)
• EnemyStateMachine and HeroStateMachine (controlling enemy and player behaviors)
• Specific scripts for Attacks (both melee and skills) and DamagePopup
• Managers and Utilities: Include manager scripts from “Assets/Script/Manager” (such as ActionManager, CameraShakeManager, GameAssets, etc.) that encapsulate common game-wide functionality.
• Third-Party Plugins & Libraries: Identify the use of DOTween (found in Assets/Plugins/Demigiant/DOTween) for tweening/animation and TextMesh Pro for text rendering (in Assets/TextMesh Pro). These play key roles in animation and UI delights.
Relationships and Interactions
• The Input Management component sends events to the PlayerController (Assets/Script/HeroStateMachine/Player) and through the CombatStateMachine to trigger transitions between game states.
• The State Machines (CombatStateMachine, EnemyStateMachine, HeroStateMachine) interact with each other and with various UI components (GUI items, panels) to update the status of characters and display information (see Assets/Prefabs/GUI).
• The Animation controllers and related prefabs (Assets/Animation, Assets/Animator, Prefabs for characters and attacks) are tied to the visual presentation of actions that are driven by the state machines.
• Manager modules (like ActionManager and CameraShakeManager) work across the game logic to coordinate user actions, animations, and scene transitions.
• Third-party libraries such as DOTween interact through the Manager and Animation components to provide smooth transitions and effects.
Architectural Patterns and Design Principles
• State Machine Pattern: Clearly, various state machines drive turn-based combat and enemy/hero behaviors.
• MVC or Component-Based Design: Unity’s approach is naturally component-based. Indicate how scripts (logic) and prefabs (UI/art) interconnect.
• Separation of Concerns: Distinguish clearly between the Input/GUI layer, game logic (combat, state machine), and the visual/animation layers.
• Modular and Extensible Design: The use of separate folders for Attacks, Manager, and State Machines shows a modular strategy.
• Unity Engine (with its Scene, Asset, and ProjectSettings structure)
• DOTween for tweening and animation effects
• TextMesh Pro for advanced text rendering
• Use of Unity’s Input System (with .inputactions file) to handle user inputs