feat: add map levels

This commit is contained in:
Иванов Иван
2024-08-16 09:22:34 +02:00
parent 46c877f036
commit 4a45d1d615
6 changed files with 40 additions and 10 deletions

View File

@@ -14,7 +14,7 @@ namespace Client.Domain.Service
private static readonly uint DELTA_X = 20;
private static readonly uint DELTA_Y = 18;
public List<MapBlock> SelectImages(float viewportWidth, float viewportHeight, Vector3 heroPosition, float scale)
public List<MapBlock> SelectImages(float viewportWidth, float viewportHeight, Vector3 heroPosition, float scale, int level)
{
var viewportCenter = new Tuple<float, float>(viewportWidth / 2, viewportHeight / 2);
@@ -46,7 +46,7 @@ namespace Client.Domain.Service
(blockTopLeft.Item2 - topLeft.Item2) / scale
);
result.Add(new MapBlock(x, y, delta.Item1, delta.Item2, BLOCK_SIZE / scale));
result.Add(new MapBlock(x, y, delta.Item1, delta.Item2, BLOCK_SIZE / scale, level));
}
}

View File

@@ -13,20 +13,24 @@ namespace Client.Domain.ValueObjects
private float deltaY;
private float size;
public uint Id => (BlockX + BlockY) * (BlockX + BlockY + 1) / 2 + BlockX;
public int Id => (IdWithOutLevel + Level) * (IdWithOutLevel + Level + 1) / 2 + IdWithOutLevel;
public uint BlockX { get; set; }
public uint BlockY { get; set; }
public float DeltaX { get => deltaX; set { if (value != deltaX) { deltaX = value; OnPropertyChanged(); } } }
public float DeltaY { get => deltaY; set { if (value != deltaY) { deltaY = value; OnPropertyChanged(); } } }
public float Size { get => size; set { if (value != size) { size = value; OnPropertyChanged(); } } }
public int Level { get; set; }
public MapBlock(uint blockX, uint blockY, float deltaX, float deltaY, float size)
private int IdWithOutLevel => (int) ((BlockX + BlockY) * (BlockX + BlockY + 1) / 2 + BlockX);
public MapBlock(uint blockX, uint blockY, float deltaX, float deltaY, float size, int level)
{
BlockX = blockX;
BlockY = blockY;
DeltaX = deltaX;
DeltaY = deltaY;
Size = size;
Level = level;
}
}
}