How phungbatung/timetwin works
Main Components
• Game Engine Core: Represent Unity’s built-in systems (e.g., Scene Management, Physics2D, Renderer, Input Manager). Although these are implicit, they provide the runtime environment.
• Assets/Content: Include subcomponents like:
– Animation: Controls animations (using animation clips, controllers, etc.)
– Data: Level data and configuration items (LevelsData).
– Materials, Sprites, and TextMesh Pro resources for rendering and UI.
• Plugins: Highlight DOTween, which enables advanced tweening for game object animations and transitions. Note the structure under Assets/Plugins/Demigiant/DOTween.
• Scripts: The heart of the game logic is implemented in the various scripts:
– Controller: Includes Avatar, PlayerMovement, CloneMovement, and MoveablePlatform classes. These drive character and object behaviors.
– GameplayElements: Contains key game mechanics (ActivatedDoor, PortalSystem, BoxShape, etc.), which manage interactions like doors, portals, and other environment triggers.
– Game Manager: Central game flow (GameManager.cs) orchestrates states, level transitions, and overall game logic.
– LevelData: Scripts managing level configurations and level-related state.
– Record: Contains ReplaySystem and RecordData along with UI timer management for recording or gameplay replay features.
– UI: Organized under Scripts/UI, handling buttons (e.g., Menu, Next, Quit, Record) and Level Selection to create interactive game menus.
• Scenes: Contains several Unity scene files that lay out the game’s levels, menus, and templates (e.g., LevelMenu, StartScene, LevelSceneTemplate). These represent entry points into the game.
• Input System: Managed under Assets/InputSystem with configurations for different types of input actions (e.g., ControllerInput, PlayerInput).
Relationships and Interactions
• The Game Manager sits central in the architecture and coordinates scene transitions, level loading, and state management.
• Controllers (Avatar, PlayerMovement, etc.) interact directly with the Game Manager and possibly with UI elements or game physics.
• The GameplayElements (e.g., PortalSystem, ActivatedDoorSystem) interact with both the Game Manager and individual controllers to drive level interactions.
• LevelData and Data assets provide configuration and runtime values that are consumed by the Game Manager and various Scripts controlling gameplay.
• The UI system interacts with the Game Manager (to trigger level changes, record gameplay, pause/resume, etc.) and uses event-based inputs.
• DOTween (from the Plugins folder) is leveraged in various scripts to perform animations and transitions.
Architectural Patterns and Design Principles
• Modular Design: The scripts are divided into logical modules: Controllers, GameplayElements, UI, and Record. This modularization ensures each component is individually manageable and testable.
• Event-driven Interactions: Likely used in input handling and UI button events to trigger game logic (e.g., level selection, game state transitions).
• Use of External Plugins: DOTween is a notable external dependency that abstracts animation interpolation, highlighting a reliance on third-party time-based transitions.
Relevant Technologies and Frameworks
• Unity Engine – for rendering, physics, scene management, and overall game runtime.
• DOTween Framework – for tween-based animations and smooth transitions.
• Unity Input System – a modern approach for handling various input devices.
• Unity UI (likely powered by TextMesh Pro for text rendering as seen in the project).