Remove obsolete project files for MrGameEng.AI, MrGameEng.Assets, MrGameEng.Atlases, and MrGameEng.Collisions modules. Introduce new AssetManager and related classes for asset loading and management, including support for texture atlases and mod definitions. Enhance mod loading capabilities with DefDatabase and LanguageManager for JSON-based definitions and localization. Implement a shelf packing algorithm for efficient texture atlas creation.

This commit is contained in:
Leonid Pershin
2026-06-12 07:47:04 +03:00
parent 1f87fb0b74
commit c30e2ce764
70 changed files with 0 additions and 233 deletions
@@ -0,0 +1,46 @@
using Microsoft.Xna.Framework;
using Xunit;
namespace MrGameEng.Pathfinding.Tests;
/// <summary>
/// Размеры грида фиксируются в конструкторе; «уехавший» грид должен давать
/// громкую ошибку, а не молчаливое чтение мимо границ.
/// </summary>
public class GridResizeTests
{
private sealed class ResizableGrid : IPathGrid
{
public int Width { get; set; } = 4;
public int Height { get; set; } = 4;
public bool IsPassable(int x, int y) => true;
public float Cost(int x, int y) => 1f;
}
[Fact]
public void FindPath_AfterGridResize_Throws()
{
var grid = new ResizableGrid();
var pathfinder = new GridPathfinder(grid);
grid.Width = 8;
Assert.Throws<InvalidOperationException>(() =>
pathfinder.FindPath(new Point(0, 0), new Point(1, 1), [])
);
}
[Fact]
public void FlowFieldBuild_AfterGridResize_Throws()
{
var grid = new ResizableGrid();
var builder = new FlowFieldBuilder(grid);
grid.Height = 8;
Assert.Throws<InvalidOperationException>(() =>
builder.Build([new Point(0, 0)], new FlowField())
);
}
}