# PlantsvsZombies **Repository Path**: lavendervv/plantsvs-zombies ## Basic Information - **Project Name**: PlantsvsZombies - **Description**: 用 Unity 代码搭建的植物大战僵尸白天关复刻,包含 1-1 到 1-5。 - **Primary Language**: C# - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-10-02 - **Last Updated**: 2026-11-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: Unity ## README [中文](README.md) | **English** # Plants vs. Zombies - Day Lawn Remake A Unity 2022.3 project (built with Tuanjie Editor 1.10.0). **The scene is empty.** The committed `SampleScene.scene` contains no game objects at all; `GameRoot.Bootstrap` builds the entire game in code at runtime via `[RuntimeInitializeOnLoadMethod]`. There is no hand-maintained prefab or scene YAML to merge. ## Running Open this folder in Tuanjie (or Unity 2022.3), open `Assets/Scenes/SampleScene.scene` and press Play. ## What is in the build - **Core loop**: sun economy (falling sun + sunflowers), seed packets with cost / recharge / affordability dimming, shovel removal, grid placement, zombie waves, lawn mowers, wave progress bar, huge wave warning, win and loss handling, level select and saved progress - **8 plants**: Sunflower, Peashooter, Repeater, Snow Pea, Wall-nut, Potato Mine, Cherry Bomb, Chomper - **5 zombies**: basic, conehead, buckethead, pole vaulting (jumps the first plant), flag bearer (huge wave marker) - **5 day-lawn levels** (1-1 to 1-5). Wave curves and seed unlocks live in `Assets/Scripts/Core/Levels.cs`; difficulty is designed against a "needed DPS / owned DPS" ratio, see P-05 in `AINotes/Pitfalls.md` - **Animation**: a four-frame walk cycle for every zombie kind, plus bite lunges, hit flashes, a backwards death fall and a vault arc; a four-frame idle sway for the sunflower Lanes open up progressively: the opening waves walk down a single row, the lawn widens by a lane every second wave, and only the final "huge wave" covers all five rows. ## Layout | Path | Purpose | |---|---| | `Assets/Scripts/Core/` | Tuning and data: `GameConfig` (1440x660 design space, grid, sun, combat constants), `Defs` (plant / zombie definitions), `Levels` (waves) | | `Assets/Scripts/Game/` | Simulation: `GameRoot`, `Board`, `Plants`, `Zombies`, `Projectiles`, `SunSystem`, `LawnMowers` | | `Assets/Scripts/UI/` | `Hud`, `SeedBank`, `Screens`, `UiKit` | | `Assets/Scripts/Art/` | `Art`: sprite lookup by name with a procedural placeholder fallback, so the code runs before the art exists | | `Assets/Resources/Art/` | 41 PNGs loaded by name (`Art.Get("peashooter")`) | | `artPrompt.md` | Every generated asset's prompt, model parameters and slicing rules | | `AINotes/` | Project manual: architecture, module facts, conventions and a pitfall log; read it before changing code | ## Conventions - Layout and balance numbers live in `GameConfig` / `Defs`, never inlined into gameplay logic - Coordinates use a 1440x660 design space: lawn pinned to the bottom, HUD pinned to the top. `CanvasScaler` matches width, so all nine columns stay visible at any aspect ratio - Presentation is separate from simulation: `X` / `Col` / `Row` are gameplay positions; sway, bob and tilt only touch the visual transform - Animation frames share one canvas and are bottom-aligned, so a cycle never jumps in size between frames ## Art Everything is generated through SeaGames. The original prompts, model parameters and the slicing / normalisation rules are recorded in `artPrompt.md`. This is a study remake. Plants vs. Zombies is a PopCap / EA property; the sprites here are generated lookalikes and none of the original assets are included. ## Verification Gameplay changes are accepted by running `Tuanjie.exe -batchmode` against a temporary mirror of the project: it enters real Play mode, drives a scripted scenario, asserts each expectation and captures screenshots. 52 checks currently cover planting costs, seed recharge, the shovel, sun production and falling, wave lanes, lawn mowers, win and loss, and both the walk and idle cycles (frame advance and on-screen height). There is no committed test suite yet. If you add one, `AGENTS.md` asks for `Assets/Tests/` with an asmdef, targeting the pure C# in `Core/`. ## Known gaps - **No sound effects or music** - the biggest remaining distance from the original - Day lawn only: night, pool, roof, mini-games and the Zen garden are not implemented - UI text is English (matching the 2009 original). Unity's built-in font has no CJK glyphs, so a Chinese UI needs a CJK font asset imported first - Only the sunflower has an idle animation; the other plants are still single static sprites