|
|
1 месяц назад | |
|---|---|---|
| .. | ||
| Items | 1 месяц назад | |
| Monsters | 1 месяц назад | |
| ARCHITECTURE.md | 1 месяц назад | |
| ARCHITECTURE.md.meta | 1 месяц назад | |
| COPY_PASTE_EXAMPLES.cs | 1 месяц назад | |
| COPY_PASTE_EXAMPLES.cs.meta | 1 месяц назад | |
| CharacterSheet.cs | 1 месяц назад | |
| CharacterSheet.cs.meta | 1 месяц назад | |
| CharacterStats.cs | 1 месяц назад | |
| CharacterStats.cs.meta | 1 месяц назад | |
| CombatResolver.cs | 1 месяц назад | |
| CombatResolver.cs.meta | 1 месяц назад | |
| IMPLEMENTATION_CHECKLIST.md | 1 месяц назад | |
| IMPLEMENTATION_CHECKLIST.md.meta | 1 месяц назад | |
| INTEGRATION_EXAMPLE.md | 1 месяц назад | |
| INTEGRATION_EXAMPLE.md.meta | 1 месяц назад | |
| Items.meta | 1 месяц назад | |
| Monsters.meta | 1 месяц назад | |
| QUICK_START.md | 1 месяц назад | |
| QUICK_START.md.meta | 1 месяц назад | |
| README.md | 1 месяц назад | |
| README.md.meta | 1 месяц назад | |
| RoomEncounterConfig.cs | 1 месяц назад | |
| RoomEncounterConfig.cs.meta | 1 месяц назад | |
This folder contains the foundation for a turn-based combat system with agents, monsters, items, and encounters.
CharacterStats — Base statistics for any character (Agent or Monster)
MaxHealth — Total durabilitySpeed — Initiative and movement speedAttack — Physical damage outputDefense — Physical damage reductionMagic — Magical power and spell effectivenessCharacterSheet — Wraps stats with equipment and temporary bonuses
Items (Weapon, Armor)
Monster — A template for spawning monster instances
MonsterEncounter — Represents monsters in a single room
RoomEncounterConfig — Configures encounter spawning
In the editor, create ScriptableObjects of type Weapon and Armor:
Assets/Resources/Items/ or similarExample weapon config:
Example armor config:
Create ScriptableObjects of type Monster:
Assets/Resources/Monsters/ or similarExample monster config:
When spawning agents, you can give them starting equipment:
var stats = new CharacterStats(); // Uses defaults or configure manually
var sheet = new CharacterSheet(stats);
sheet.EquipWeapon(playerWeapon);
sheet.EquipArmor(playerArmor);
var agent = new MazeAgent(agentName, startRoom, sheet);
Or agents can pick up loot after defeating monsters (integrate with your combat system).
Update MazeSceneBuilder to pass RoomEncounterConfig to AutonomousAgentBrain.Initialize():
var encounterConfig = new RoomEncounterConfig()
{
EnableEncounters = true,
EncounterChance = 0.7f,
MinMonstersPerRoom = 1,
MaxMonstersPerRoom = 3,
MonsterPool = new[] { goblin, orc, troll }
};
Then in the generator or brain, when a new room is created:
if (encounterConfig.ShouldHaveEncounter())
{
var encounter = new MonsterEncounter();
encounter.SpawnMonsters(
encounterConfig.MonsterPool,
encounterConfig.MinMonstersPerRoom,
encounterConfig.MaxMonstersPerRoom
);
room.Encounter = encounter;
}
The AutonomousAgentBrain now has:
PeekThroughExit(exit, agent) — Returns perceived challenge ratingShouldTakeExit(exit, agent) — Evaluates if exit is worth takingFilterByThreat(exits, agent) — Removes dangerous exits from choice listThis is automatically called during ChooseExit() — agents will naturally avoid high-threat rooms if safer exits exist.
You'll need to add:
Combat resolution — When an agent enters a room with monsters
Loot distribution — When a monster dies
UI integration
Difficulty scaling
CharacterStatsCharacterSheetGetEffectiveStat() methodWeapon/Armor if applicableInherit from Item:
public class Consumable : Item
{
[SerializeField] private int _healthRestore = 20;
public override bool OnEquip(CharacterSheet character)
{
// Use immediately instead of equipping
character.Stats.CurrentHealth += _healthRestore;
return false; // Don't stay equipped
}
}
Override MonsterEncounter.GetPerceivedChallengeRating() for more complex threat evaluation:
// E.g., factor in armor, magic resistance, count of monsters, etc.