подготовка анимаций тайлов
This commit is contained in:
parent
e922061a9f
commit
0ccc504022
3 changed files with 22 additions and 1 deletions
14
ZoFo/GameCore/GameManagers/MapManager/MapElements/Frame.cs
Normal file
14
ZoFo/GameCore/GameManagers/MapManager/MapElements/Frame.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
|
||||||
|
{
|
||||||
|
public class Frame
|
||||||
|
{
|
||||||
|
public int Duration { get; set; }
|
||||||
|
public int TileId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,5 +11,6 @@ namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
public ObjectGroup Objectgroup { get; set; }
|
public ObjectGroup Objectgroup { get; set; }
|
||||||
|
public List<Frame> Animation { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,13 @@ namespace ZoFo.GameCore.GameManagers.MapManager
|
||||||
if (tileSet.FirstGid <= chunk.Data[i])
|
if (tileSet.FirstGid <= chunk.Data[i])
|
||||||
{
|
{
|
||||||
int number = chunk.Data[i] - tileSet.FirstGid;
|
int number = chunk.Data[i] - tileSet.FirstGid;
|
||||||
|
Tile tile = tileSet.Tiles[number]; // По факту может быть StopObjectom, но на уровне Tiled это все в первую очередь Tile
|
||||||
|
|
||||||
|
|
||||||
|
if (tile.Animation is not null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int relativeColumn = number % tileSet.Columns;
|
int relativeColumn = number % tileSet.Columns;
|
||||||
int relativeRow = number / tileSet.Columns; // относительно левого угла чанка
|
int relativeRow = number / tileSet.Columns; // относительно левого угла чанка
|
||||||
|
@ -84,7 +91,6 @@ namespace ZoFo.GameCore.GameManagers.MapManager
|
||||||
(i % chunk.Width) * _tileMap.TileWidth + chunk.X * _tileMap.TileWidth,
|
(i % chunk.Width) * _tileMap.TileWidth + chunk.X * _tileMap.TileWidth,
|
||||||
(i / chunk.Height) * _tileMap.TileHeight + chunk.Y * _tileMap.TileHeight);
|
(i / chunk.Height) * _tileMap.TileHeight + chunk.Y * _tileMap.TileHeight);
|
||||||
|
|
||||||
Tile tile = tileSet.Tiles[number]; // По факту может быть StopObjectom, но на уровне Tiled это все в первую очередь Tile
|
|
||||||
|
|
||||||
switch (tile.Type)
|
switch (tile.Type)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue