# Town System Quick Setup Guide ## What Has Been Created ### Core Scripts ✅ **TownManager.cs** - Main town controller ✅ **TownShopManager.cs** - UI interaction handler ✅ **TownBuilding.cs** - Base building class ✅ **TownShop.cs** - Shop logic and inventory ✅ **TownShopUI.cs** - Complete shop interface ### UI Assets ✅ **TownUI.uxml** - Main town visual layout ✅ **TownUI.uss** - Town styling ### Helper Scripts ✅ **TownSetupHelper.cs** - Auto-configuration tool ✅ **ItemCreatorHelper.cs** - Sample item creation ## Quick Setup Steps ### 1. Create Sample Items (Editor Only) 1. In Unity Editor, go to **RPG Tools > Create Sample Items** 2. This creates weapons, armor, potions, and tools in Resources/Items/ ### 2. Setup Town Scene 1. Open the existing `TownScene.unity` 2. Create empty GameObject "TownManager" 3. Add `TownManager` component 4. Create UI Document GameObject 5. Assign `TownUI.uxml` to UI Document 6. Link UI Document to TownManager's `townUI` field ### 3. Auto-Configure Shops 1. Add `TownSetupHelper` component to TownManager 2. In Inspector, click **Setup Sample Town** 3. Click **Setup Shop Manager** 4. This creates all shop GameObjects with proper configuration ### 4. Test the System 1. Play the scene 2. Click on colored building squares to open shops 3. Buy/sell items with different characters 4. Money and inventory persist between shop visits ## Visual Layout The town uses a grid layout with: - **Red squares** = Weapon Shop - **Blue squares** = Armor Shop - **Green squares** = Potion Shop - **Orange squares** = General Store - **Purple squares** = Adventurer's Guild (coming soon) - **Light blue squares** = Harbor (coming soon) - **Tan squares** = Inn (coming soon) - **Brown strips** = Roads ## Shop Features ### Weapon Shop - "The Forge" - Sells swords, axes, bows, daggers - 30% markup on base prices - Accepts weapon trade-ins at 60% value ### Armor Shop - "Ironclad Armory" - Sells helmets, chest armor, accessories - 25% markup on base prices - Accepts armor trade-ins at 60% value ### Potion Shop - "The Bubbling Cauldron" - Sells health/mana potions, antidotes - 40% markup (specialized goods) - Accepts consumable trade-ins at 50% value ### General Store - "Pete's General Goods" - Sells basic weapons, armor, tools, misc items - 20% markup (competitive prices) - Accepts most items at 65% value ## Currency System - **1 Gold = 10 Silver = 100 Copper** - Characters start with varied amounts of money - Automatic currency conversion when buying/selling - Money displays update in real-time ## Next Steps ### Immediate Improvements 1. **Add More Items**: Create specialized weapons and armor 2. **Polish UI**: Improve shop interface styling 3. **Add Tooltips**: Show item stats on hover 4. **Sound Effects**: Add audio feedback for transactions ### Future Features 1. **Adventurer's Guild**: Quest system and job board 2. **Harbor System**: Travel to other towns/locations 3. **Inn Functionality**: Rest, heal, save progress 4. **NPC Dialogue**: Conversations with shopkeepers 5. **Dynamic Events**: Special sales, traveling merchants ## Troubleshooting ### Common Issues - **Shops don't open**: Ensure TownShopManager has shop references - **No items in shops**: Run "Setup Sample Town" again - **UI not responsive**: Check that UXML/USS files are properly linked - **Money not saving**: Verify GameStateManager integration ### Debug Tools - Use TownSetupHelper context menu options - Check console for setup completion messages - Verify item loading in Resources/Items/ folders ## Integration Notes This town system integrates seamlessly with your existing: - **TeamCharacter system**: Uses gold/silver/copper fields - **Save system**: Works with GameStateManager - **Scene management**: Proper transitions to/from map - **Item system**: Compatible with WeaponItem, ArmorItem, etc. The system is designed to be: - **Modular**: Easy to add new building types - **Extensible**: Simple to add new shop features - **Maintainable**: Clear separation of concerns - **User-friendly**: Intuitive click-to-interact interface ## Success Indicators You'll know the system is working when: ✅ Town scene loads with colored building grid ✅ Clicking buildings opens appropriate shop interfaces ✅ Shop inventories populate with items automatically ✅ Buy/sell transactions update money and inventory ✅ Money changes persist when switching between shops ✅ System integrates smoothly with existing save/load The town system provides a solid foundation that can grow with your game's needs!