How azivast/state-based-skyforce works
Project type and purpose
• This is a 2D shooter game built in Unity.
• It follows a component-based architecture: GameObjects + Scripts + Prefabs.
• Core gameplay revolves around waves of enemies (Heli, Ship, PropPlane), a player ship, allies, projectiles, pickups, and a state-machine governing enemy behavior.
File structure
Top-level structure under Assets:
– Ally, Enemy, Player, Barrier, Projectiles, Pickups (game entities & behaviors)
– WaveManager & WaveObject (wave/spawn logic)
– StateMachine (BaseState, StateMachine classes)
– GameManager (central orchestrator)
– WorldMovement, Paths (scene/world scrolling & path logic)
– Menus & UI (MainMenu, Buttons, ScoreCounter, HealthBar, WeaponUpgradeCounter)
– Effects, Sfx, AudioMixer (visual/audio feedback)
– TextMeshPro, Font (text rendering)
– Scenes/Stage1.unity (entry point)
Gather additional insights
• The README only identifies project name.
• The use of a StateMachine folder shows that entities use a state-pattern.
• Prefab hierarchies define visual/physics/rend er setup; scripts add logic.
Main components & relationships
– Scene Management
– Physics, Rendering, Audio, Input subsystems
b. Scenes
– Stage1.unity loads on play
– MainMenu.unity for UI
c. Game Loop & Orchestration
– GameManager: initializes systems, listens for game state changes
– WaveManager + WaveObject: defines waves, spawns entities
– WorldMovement + Paths: scrolls background, moves entities along paths
d. Entity Layer (all game actors)
– Player (PlayerBehaviour, HealthObject, WeaponStats, Animator)
– Allies (AllyBehaviour)
– Enemies: Heli, Ship, PropPlane – each using a StateMachine (Fly, Shoot, Die, Despawn states)
– Projectiles (ProjectileBehaviour, MissleBehaviour)
– Barriers & Damageable interface
– Pickups (Score, WeaponUpgrade)
e. UI Layer
– HealthBar, ScoreCounter, WeaponUpgradeCounter
– Menus (Buttons, SceneChanger)
f. Effects & Resources
– Particle/Explosion/Smoke prefabs
– Sfx & AudioMixer
– Materials, Textures, Sprites, Fonts (TextMeshPro)
Architectural patterns & design principles
• Component-based design: scripts attach to prefabs, making reusable behaviors.
• State Pattern for enemy AI via StateMachine/BaseState.
• MVC-style separation in UI: Counters & Panels observe game events.
• Single GameManager as facade for high-level control.