This guide covers the implementation of the post-battle looting system, carry capacity management, and game over screen functionality for when battles end.
PostBattleLootSystem.cs)CharacterCarryCapacity.cs)GameOverScreen.cs)The new systems integrate automatically with the existing GameManager:
// Victory Detection (Enhanced)
- Properly detects when all enemies are defeated
- Automatically starts looting phase
- Distributes rewards to surviving players
// Defeat Detection (Enhanced)
- Detects when all players are dead
- Shows comprehensive game over screen
- Displays final statistics and achievements
Add carry capacity to your characters:
// Add to player prefabs
var carryCapacity = playerPrefab.AddComponent<CharacterCarryCapacity>();
carryCapacity.carrySystem.baseCarryCapacity = 50; // Base capacity
carryCapacity.carrySystem.strengthMultiplier = 5f; // STR bonus
For custom UI, create these UI elements:
Different enemy types drop different items:
// Skeleton Enemies
- Bone (30% chance)
- Rusty Sword (20% chance)
- Bone Dust (15% chance)
// Bandit Enemies
- Thieves' Tools (40% chance)
- Rope (30% chance)
- Dagger (20% chance)
- Extra copper coins
// Orc/Goblin Enemies
- Crude Axe (30% chance)
- Hide Armor (25% chance)
- Iron Ration (20% chance)
Base currency generation per enemy:
Default item weights:
Based on percentage of max capacity:
Light Load (0-33%): No penalties
Medium Load (34-66%): -25% movement speed
Heavy Load (67-100%): -50% movement, -3 DEX
Overloaded (100%+): -75% movement, -6 DEX
Max Capacity = Base Capacity + (Strength × Strength Multiplier)
Default: 50 + (STR × 5) pounds
The system tracks and displays:
Journey:
Combat:
Social Impact:
Economic:
Final message based on achievements:
BattleSetup Integration:
GameManager.MainBattleLoopCoroutine()Character.IsDead detectionBattleSetupData and CombatDataTransferInventory Integration:
Inventory componentCombatDataTransfer.miscItems for session dataCharacter Integration:
Character class functionalityCharacter.Strength for capacity calculationBattleTestMode now includes:
Character component with IsDead = truePostBattleLootSystem is created automaticallyCharacterCarryCapacity component is added to charactersCharacter component with Strength propertyInventory component exists for weight calculationIsDead = trueGameOverScreen component is createdWeaponItem, ArmorItem, etc.)// In your battle scene
var lootSystem = battleScene.AddComponent<PostBattleLootSystem>();
lootSystem.baseGoldReward = 10; // Increase gold rewards
lootSystem.showDebugLogs = true; // Enable debugging
// When battle ends with victory
lootSystem.InitializeLootSystem(defeatedEnemies);
lootSystem.StartLooting();
// Add to character prefab or runtime setup
var capacity = character.AddComponent<CharacterCarryCapacity>();
capacity.carrySystem.baseCarryCapacity = 75; // Higher base capacity
capacity.carrySystem.strengthMultiplier = 7f; // More STR bonus
capacity.showDebugInfo = true; // Enable weight logging
// Setup in main scene
var gameOver = gameObject.AddComponent<GameOverScreen>();
gameOver.showDetailedStats = true; // Show all statistics
// Update statistics during gameplay
gameOver.UpdateStatistic("enemiesslain", 1);
gameOver.UpdateStatistic("peoplehelped", 1);
gameOver.UpdateStatistic("goldearned", 50);
EnemyCharacterData.dropTableAssets/Scripts/
├── BattleScene/
│ ├── PostBattleLootSystem.cs # Main looting logic
│ ├── GameManager.cs # Enhanced battle detection
│ └── BattleTestMode.cs # Enhanced test setup
├── Objects/
│ └── CharacterCarryCapacity.cs # Weight management
└── UI/
└── GameOverScreen.cs # Defeat screen system
This system provides a solid foundation for post-battle gameplay and can be extended as your RPG systems grow!