# UnityNew **Repository Path**: clockdotnet/UnityNew ## Basic Information - **Project Name**: UnityNew - **Description**: html和Untiy (URP) 版的复刻加创新的Battle City。支持单人游戏、双人合作以及人机合作模式,包括多种坦克类型、丰富的道具系统和6 个关卡。 - **Primary Language**: C# - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-04-16 - **Last Updated**: 2026-10-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: 项目, 重要 ## README # TankGame: Tank Battle A classic tank battle game implemented using Unity and Universal Render Pipeline (URP). The html version is in the `html` folder. ## Project Introduction TankGame is a Unity remake of the classic arcade game "Tank Battle". It supports single-player, two-player co-op, and player-with-AI battle modes. The game fully restores the original core gameplay, including various tank types, a rich power-up system, 6 meticulously designed levels. ## Features ### Game Modes - **1P (Single Player)** - Face enemy tank offensives alone to protect the base. - **2P (Co-op)** - Local two-player cooperation to complete levels together. - **2P_CPU (With AI)** - players with AI-controlled tanks. ### Tank System - **Enemy Tanks** - 5 Types, each with unique characteristics: - Normal (type0) - Basic enemy, 100 points - Fast (type1) - Rapid movement, 200 points - Heavy (type2) - Double HP, 300 points - Fortified (type3) - Triple HP, 400 points - Armored (type4) - Quadruple HP, 500 points ### Power-Up System The game includes 22 types of power-ups, divided into positive and negative categories: **Positive Power-Ups (16 Types)** - Invincibility, Armor, Extra Life, Rapid Fire, Speed Boost, Steel Piercer, Grass Clearer, Global Explosion, Water Walk, Handgun, Traction, Penetration, Super Bullet, Time Stop, Iron Shovel, Missile **Negative Power-Ups (6 Types)** - Teleport, Slow Bullet, Slow Down, Freeze, Allied Explosion, Rusted Shovel ### Other Features - Procedurally generated tank and power-up icons - Synthesized sound effect system (no external audio resources required) - Complete level validation tools - 6 meticulously designed levels ## Project Structure ``` Unity/ ├── Assets/ │ ├── _Project/ │ │ ├── Scripts/ │ │ │ ├── Editor/ # Editor Tools │ │ │ └── Runtime/ # Game Runtime Scripts │ │ │ ├── Audio/ # Audio System │ │ │ ├── Bullet/ # Bullet System │ │ │ ├── Core/ # Core Game Logic │ │ │ ├── Input/ # Input System │ │ │ ├── Map/ # Map System │ │ │ ├── PowerUp/ # Power-Up System │ │ │ ├── Tank/ # Tank System │ │ │ └── UI/ # User Interface │ │ ├── ScriptableObjects/ # Game Data Assets │ │ ├── Levels/ # Level Files │ │ └── Input/ # Input Configuration Files │ └── Settings/ # URP Settings └── ProjectSettings/ # Unity Project Settings ``` ## Quick Start ### Environment Requirements - Unity 2022.3 or higher - Universal Render Pipeline (URP) ## Level Design Levels are stored as text files in the `Assets/_Project/Levels/` directory: - `Level1.txt` ~ `Level6.txt` Maps are designed using character grids and support the following elements: - Bricks, Hard Bricks, Steel, Base, Grass, Water, Snow - Player Spawn Points, Enemy Spawn Points Use the Unity menu `TankGame > Validate Levels` to verify the validity of level files. ## Technical Details ### Coordinate System Conversion The game adopts a pixel coordinate system, implementing the mutual conversion between logical coordinates and world coordinates via the `Coordinate` class: - Map Size: 26 × 26 Grids - Pixels per Grid: 16 × 16 - Pixels per Unit: 8 ### Collision Detection - Tank vs Map: Based on AABB collision detection - Bullet vs Tank: Rectangle collision judgment - Bullet vs Map: Raycast detection and cell query ### AI Behavior Enemy tanks possess the following AI characteristics: - Random movement and turning - Detect base position and attack - Obstacle avoidance and path optimization - Different attack frequencies for different types ## License This project is open-source under the MIT License. See the LICENSE file for details. ## Credits Inspired by the classic arcade game "Battle City" (1985, Namco).