CDN fight 3
This commit is contained in:
@@ -70,11 +70,25 @@ public class DungeonMobDefinition
|
||||
|
||||
// Visuals
|
||||
/// <summary>
|
||||
/// Path to the mob's .tscn scene file on CDN (e.g., "scenes/mobs/skeleton.tscn")
|
||||
/// JSON configuration for mob sprites and animations
|
||||
/// Example: {
|
||||
/// "sprites": {
|
||||
/// "idle_front": "assets/sprites/skeleton_idle_front.png",
|
||||
/// "idle_back": "assets/sprites/skeleton_idle_back.png",
|
||||
/// "run_front": "assets/sprites/skeleton_run_front.png"
|
||||
/// },
|
||||
/// "frameWidth": 64,
|
||||
/// "frameHeight": 64,
|
||||
/// "fps": 8,
|
||||
/// "animations": {
|
||||
/// "idle_front": {"frames": 8, "loop": true},
|
||||
/// "run_front": {"frames": 8, "loop": true}
|
||||
/// }
|
||||
/// }
|
||||
/// If null/empty, client uses fallback placeholder shape
|
||||
/// </summary>
|
||||
[MaxLength(256)]
|
||||
public string? ScenePath { get; set; }
|
||||
[MaxLength(4096)]
|
||||
public string? SpriteConfigJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Color tint applied to the mob (hex, e.g., "#ff0000" for red variant)
|
||||
@@ -87,16 +101,22 @@ public class DungeonMobDefinition
|
||||
/// </summary>
|
||||
public float Scale { get; set; } = 1.0f;
|
||||
|
||||
// Legacy fields - kept for backwards compatibility, ScenePath takes priority
|
||||
[MaxLength(128)]
|
||||
public string SpriteSheet { get; set; } = "";
|
||||
public int SpriteWidth { get; set; } = 32;
|
||||
public int SpriteHeight { get; set; } = 32;
|
||||
|
||||
public float AnimationSpeed { get; set; } = 8f; // Frames per second
|
||||
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
|
||||
// Helper to get parsed sprite config
|
||||
[NotMapped]
|
||||
public Dictionary<string, object>? SpriteConfig
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(SpriteConfigJson)) return null;
|
||||
try { return System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, object>>(SpriteConfigJson); }
|
||||
catch { return null; }
|
||||
}
|
||||
}
|
||||
|
||||
// Helper methods for JSON parsing
|
||||
[NotMapped]
|
||||
public Dictionary<string, float> Resistances
|
||||
|
||||
Reference in New Issue
Block a user