# Project Overview

This project is a Unity 2D platformer built around reusable prefabs, separated art/script/animation folders, and scene objects that are assembled from those prefabs.

The main idea is:

```text
Art assets -> Animation clips/controllers -> Prefabs -> Scene instances
Scripts    -> Components on prefabs/scene objects
```

Do not treat scene objects as the main source of truth. For characters, enemies, projectiles, and reusable environment objects, the prefab should be the source of truth. The scene should mostly contain placed instances of those prefabs.

## Current File Structure

```text
Assets
├── Animations
│   ├── Bosses
│   │   └── AshenTitan
│   ├── Enemies
│   │   ├── Monster
│   │   └── Wizard
│   ├── Others
│   └── Player
│       └── Rika
├── Art
│   ├── Characters
│   │   ├── Bosses
│   │   ├── Enemies
│   │   └── Player
│   ├── Effects
│   │   └── Projectiles
│   ├── Environment
│   │   ├── All
│   │   ├── Backgrounds
│   │   ├── Grounds
│   │   └── Props
│   └── UI
├── Audio
│   ├── Music
│   └── SFX
├── Docs
├── Editor
├── Materials
├── Physics
├── Prefabs
│   ├── Characters
│   ├── Combat
│   ├── Environment
│   └── UI
├── Scenes
├── Scripts
│   ├── Camera
│   ├── Combat
│   ├── Enemy
│   ├── Environment
│   ├── Level
│   ├── Player
│   └── UI
└── Settings
```

## Why The Project Is Structured This Way

Unity projects can become hard to maintain when everything is mixed together. This structure separates files by responsibility:

```text
Art        = source sprites and visual assets
Animations = animation clips and animator controllers
Prefabs    = reusable configured GameObjects
Scripts    = behavior logic
Scenes     = level assembly
Docs       = team manuals
Settings   = render pipeline and Unity configuration
```

This makes it easier to answer common questions:

```text
Need to edit Rika movement?
→ Assets/Scripts/Player

Need to edit Rika's prefab setup?
→ Assets/Prefabs/Characters/Rika.prefab

Need to edit monster animation clips?
→ Assets/Animations/Enemies/Monster

Need to place a fire camp checkpoint?
→ Use Assets/Prefabs/Environment/fire_camp.prefab in a scene

Need to change bullet behavior?
→ Assets/Scripts/Combat and Assets/Prefabs/Combat
```

## Folder Responsibilities

### Animations

`Assets/Animations` stores animation clips and animator controllers.

Use this folder for:

- `.anim` animation clips
- `.controller` animator controllers
- animation assets grouped by character/enemy type

Current examples:

```text
Assets/Animations/Player/Rika
Assets/Animations/Enemies/Monster
Assets/Animations/Enemies/Wizard
Assets/Animations/Others/fire_camp.anim
```

Why:

Animations are not raw art files and not gameplay scripts. They connect sprites to Unity's Animator system, so they live in their own folder.

### Art

`Assets/Art` stores source visual assets.

Use this folder for:

- character sprites
- enemy sprites
- background images
- ground tiles or platform art
- projectile sprites
- UI images

Current layout:

```text
Assets/Art/Characters/Player
Assets/Art/Characters/Enemies
Assets/Art/Characters/Bosses
Assets/Art/Environment/Grounds
Assets/Art/Environment/Backgrounds
Assets/Art/Environment/Props
Assets/Art/Effects/Projectiles
Assets/Art/UI
```

Why:

Raw art should stay separate from prefabs. A sprite file is only an asset. A prefab is a configured GameObject with components, scripts, colliders, animation, sorting layers, and references.

### Audio

`Assets/Audio` stores sound files.

Use this folder for:

- music tracks in `Audio/Music`
- sound effects in `Audio/SFX`

Why:

Audio should not be mixed with gameplay scripts or prefabs. Audio clips can later be referenced by prefabs, animation events, or audio manager scripts.

### Docs

`Assets/Docs` stores team documentation.

Use this folder for:

- onboarding manuals
- Unity workflow notes
- prefab rules
- debugging checklists
- team conventions

Why:

Keeping documentation inside the Unity project means it travels with the project and can be versioned with the game.

### Editor

`Assets/Editor` stores Unity editor-only scripts.

Use this folder only for tools that run in the Unity Editor, not during gameplay.

Examples:

```text
Assets/Editor/RikaAnimatorTransitionSetup.cs
Assets/Editor/animator.cs
```

Why:

Unity treats folders named `Editor` specially. Scripts here are excluded from runtime builds. Do not put gameplay scripts here.

### Materials

`Assets/Materials` is for materials used by sprites, effects, renderers, or special visual setups.

Why:

Materials affect how objects render. They should be separate from art source files and prefabs.

### Physics

`Assets/Physics` is reserved for physics-related project assets.

Use this folder for:

- Physics Material 2D assets
- collision tuning assets
- shared physics configuration assets

Why:

Physics settings often affect multiple prefabs. Keeping them in one place avoids duplicating material settings on every object.

### Prefabs

`Assets/Prefabs` stores reusable configured GameObjects.

Current layout:

```text
Assets/Prefabs/Characters
Assets/Prefabs/Combat
Assets/Prefabs/Environment
Assets/Prefabs/UI
```

Use this folder for:

- player prefab: `Rika.prefab`
- enemy prefabs: `Monster.prefab`, `Witch.prefab`
- projectile prefabs: `Rika_Bullet.prefab`, `Wizard_bullet.prefab`
- environment prefabs: `fire_camp.prefab`, `platform_.prefab`, `slope.prefab`
- reusable UI prefabs

Why:

Prefabs are the main reusable unit in Unity. If a teammate needs to place the same thing multiple times, it should probably be a prefab.

### Scenes

`Assets/Scenes` stores Unity scenes.

Current examples:

```text
Assets/Scenes/SampleScene.unity
Assets/Scenes/Level1_Rebuilt.unity
```

Use scenes for:

- level layout
- placed prefab instances
- scene cameras
- global lights
- scene-specific setup

Why:

Scenes should assemble the game world. They should not become the only place where important character or enemy logic exists.

### Scripts

`Assets/Scripts` stores runtime gameplay code.

Current layout:

```text
Assets/Scripts/Camera
Assets/Scripts/Combat
Assets/Scripts/Enemy
Assets/Scripts/Environment
Assets/Scripts/Level
Assets/Scripts/Player
Assets/Scripts/UI
```

Use this folder based on what the script controls:

```text
Player     = Rika movement, fuel, shooting, respawn
Enemy      = monster/wizard AI, health, attack hitboxes
Combat     = bullets and projectiles
Camera     = camera follow behavior
Environment = checkpoints, rest points, interactable world objects
UI         = HUD and visual bars
Level      = level-specific systems
```

Why:

Scripts should be grouped by gameplay responsibility. This makes it easier to find the correct code without searching the whole project.

### Settings

`Assets/Settings` stores Unity rendering and pipeline settings.

Examples:

```text
Assets/Settings/Renderer2D.asset
Assets/Settings/UniversalRP.asset
```

Why:

These assets control project-wide rendering behavior. Only change them when you understand the rendering impact.

## Core Design Rules

### 1. Prefabs Are The Source Of Truth

If an object is reused, configure it as a prefab.

Examples:

```text
Rika
Monster
Witch
Rika_Bullet
Wizard_bullet
fire_camp
platform_
slope
```

Avoid making important changes only to one scene instance unless the change is truly scene-specific.

### 2. Scripts Should Be Reusable Components

Scripts should usually control one clear behavior.

Examples:

```text
RikaPlayerController     = movement, jumping, dashing, player animation triggers
PlayerFuel               = Rika health/fuel
PlayerRespawn            = falling death and checkpoint respawn
PlayerShooter            = player bullet spawning
MonsterContactAttack     = enemy movement, chasing, attack timing
EnemyHealth              = enemy health and death
WizardShooter            = wizard projectile spawning
RestCheckpoint           = fire camp rest/checkpoint interaction
PlatformerCameraFollow   = camera follow behavior
```

Why:

Unity development works best when behavior is composed from components instead of one huge script.

### 3. Art, Animation, Prefabs, And Scripts Are Different Layers

Do not confuse these:

```text
Sprite asset
→ Just an image.

Animation clip
→ Changes sprites over time.

Animator controller
→ Decides which animation should play.

Prefab
→ A reusable GameObject with components and references.

Scene instance
→ A placed copy of a prefab in a level.
```

### 4. Scene Hierarchy Should Stay Clean

The scene should be readable. A teammate should be able to open the hierarchy and understand what is in the level.

Good scene objects:

```text
Main Camera
Global Light 2D
Rika
Monster
Witch
fire_camp
platform_
slope
```

Avoid:

```text
Random unconfigured GameObjects
Duplicated broken prefab instances
Objects with important one-off changes that are not saved back to prefab
```

### 5. Keep Runtime And Editor Code Separate

Runtime gameplay scripts go in:

```text
Assets/Scripts
```

Editor-only helper scripts go in:

```text
Assets/Editor
```

Do not put player, enemy, projectile, UI, or camera gameplay scripts inside `Assets/Editor`.

## Where To Put New Files

Use this table when adding new project files:

| New file type | Put it here |
| --- | --- |
| Player script | `Assets/Scripts/Player` |
| Enemy script | `Assets/Scripts/Enemy` |
| Bullet/projectile script | `Assets/Scripts/Combat` |
| Camera script | `Assets/Scripts/Camera` |
| UI script | `Assets/Scripts/UI` |
| Environment interaction script | `Assets/Scripts/Environment` |
| Player prefab | `Assets/Prefabs/Characters` |
| Enemy prefab | `Assets/Prefabs/Characters` |
| Projectile prefab | `Assets/Prefabs/Combat` |
| Environment prefab | `Assets/Prefabs/Environment` |
| UI prefab | `Assets/Prefabs/UI` |
| Player animation | `Assets/Animations/Player/Rika` |
| Enemy animation | `Assets/Animations/Enemies/<EnemyName>` |
| Environment animation | `Assets/Animations/Others` |
| Character art | `Assets/Art/Characters` |
| Environment art | `Assets/Art/Environment` |
| Projectile art | `Assets/Art/Effects/Projectiles` |
| Documentation | `Assets/Docs` |

## Current Gameplay Systems At A Glance

### Rika

Rika is the player character.

Important files:

```text
Assets/Prefabs/Characters/Rika.prefab
Assets/Scripts/Player/RikaPlayerController.cs
Assets/Scripts/Player/PlayerFuel.cs
Assets/Scripts/Player/PlayerRespawn.cs
Assets/Scripts/Player/PlayerShooter.cs
Assets/Animations/Player/Rika
```

### Enemies

Monster and Witch share several enemy systems.

Important files:

```text
Assets/Prefabs/Characters/Monster.prefab
Assets/Prefabs/Characters/Witch.prefab
Assets/Scripts/Enemy/MonsterContactAttack.cs
Assets/Scripts/Enemy/MonsterAnimator.cs
Assets/Scripts/Enemy/EnemyHealth.cs
Assets/Scripts/Enemy/MonsterAttackHitbox.cs
Assets/Scripts/Enemy/WizardShooter.cs
Assets/Animations/Enemies/Monster
Assets/Animations/Enemies/Wizard
```

### Projectiles

Player and enemy projectiles are prefabs under `Prefabs/Combat`.

Important files:

```text
Assets/Prefabs/Combat/Rika_Bullet.prefab
Assets/Prefabs/Combat/Wizard_bullet.prefab
Assets/Scripts/Combat/Bullet.cs
Assets/Scripts/Combat/EnemyProjectile.cs
```

### Environment

Environment prefabs include platforms, slopes, houses, and checkpoints.

Important files:

```text
Assets/Prefabs/Environment/fire_camp.prefab
Assets/Prefabs/Environment/platform_.prefab
Assets/Prefabs/Environment/slope.prefab
Assets/Scripts/Environment/RestCheckpoint.cs
Assets/Scripts/Player/Checkpoint.cs
```

## Recommended Workflow

When adding a new gameplay object:

1. Put raw art in the correct `Assets/Art` folder.
2. Create animation clips and controller under `Assets/Animations`.
3. Create a prefab under `Assets/Prefabs`.
4. Add scripts from `Assets/Scripts` as components.
5. Configure colliders, Rigidbody2D, sorting layer, and references on the prefab.
6. Place prefab instances into the scene.
7. Test in Play Mode.
8. Save prefab changes, not only scene instance changes.

## Project Design Summary

The project is organized to keep responsibilities separate:

```text
Art is visual source material.
Animations define motion and state changes.
Scripts define behavior.
Prefabs combine assets and behavior into reusable objects.
Scenes arrange prefabs into playable levels.
Docs explain how the team should work.
```

Following this structure helps teammates avoid broken references, duplicate objects, confusing scene-only changes, and hard-to-find gameplay logic.
