SpriteSheets
This commit is contained in:
@@ -46,14 +46,22 @@ public class DungeonSimulation
|
||||
private int _nextDroppedItemId = 1;
|
||||
private readonly Dictionary<int, DungeonMobDefinition> _mobDefinitions;
|
||||
private readonly Dictionary<int, MobAbilityDefinition>? _abilityDefinitions;
|
||||
private readonly Dictionary<int, string?>? _spriteConfigs;
|
||||
|
||||
public DungeonSimulation(DungeonLayout layout, int tier, Dictionary<int, DungeonMobDefinition> mobDefinitions, int bracketMin = 1, Dictionary<int, MobAbilityDefinition>? abilityDefinitions = null)
|
||||
public DungeonSimulation(
|
||||
DungeonLayout layout,
|
||||
int tier,
|
||||
Dictionary<int, DungeonMobDefinition> mobDefinitions,
|
||||
int bracketMin = 1,
|
||||
Dictionary<int, MobAbilityDefinition>? abilityDefinitions = null,
|
||||
Dictionary<int, string?>? spriteConfigs = null)
|
||||
{
|
||||
Layout = layout;
|
||||
Tier = tier;
|
||||
BracketMin = bracketMin;
|
||||
_mobDefinitions = mobDefinitions;
|
||||
_abilityDefinitions = abilityDefinitions;
|
||||
_spriteConfigs = spriteConfigs;
|
||||
|
||||
SpawnMobs();
|
||||
InitializeChests();
|
||||
@@ -180,6 +188,17 @@ public class DungeonSimulation
|
||||
// Use bracket-aware stat scaling
|
||||
var stats = mobDef.GetStatsForBracket(BracketMin);
|
||||
|
||||
// Get sprite config - prefer new format from _spriteConfigs, fallback to legacy SpriteConfigJson
|
||||
string? spriteConfig = null;
|
||||
if (_spriteConfigs != null && _spriteConfigs.TryGetValue(mobDef.Id, out var newConfig) && !string.IsNullOrEmpty(newConfig))
|
||||
{
|
||||
spriteConfig = newConfig;
|
||||
}
|
||||
else
|
||||
{
|
||||
spriteConfig = mobDef.SpriteConfigJson;
|
||||
}
|
||||
|
||||
var mob = new MobInstance
|
||||
{
|
||||
Id = mobSpawn.Id,
|
||||
@@ -196,7 +215,7 @@ public class DungeonSimulation
|
||||
Stats = stats,
|
||||
State = MobState.Idle,
|
||||
StateTime = (float)(rng.NextDouble() * 3f), // Randomize so mobs don't all start moving at once
|
||||
SpriteConfigJson = mobDef.SpriteConfigJson,
|
||||
SpriteConfigJson = spriteConfig,
|
||||
TintColor = mobDef.TintColor,
|
||||
Scale = mobDef.Scale,
|
||||
Type = mobDef.Type,
|
||||
|
||||
Reference in New Issue
Block a user