mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-24 12:06:37 +00:00
* Tiled Rework * fix failing tests * really fix failing tests
26 lines
827 B
C#
26 lines
827 B
C#
#region
|
|
|
|
using System.Linq;
|
|
using Microsoft.Xna.Framework.Content;
|
|
using MonoGame.Extended.Shapes;
|
|
|
|
#endregion
|
|
|
|
namespace MonoGame.Extended.Tiled
|
|
{
|
|
public sealed class TiledMapTileObject : TiledMapObject
|
|
{
|
|
public TiledMapTilesetTile TilesetTile { get; }
|
|
|
|
public TiledMapTileObject(ContentReader input, TiledMap map)
|
|
: base(input)
|
|
{
|
|
var globalTileIdentifierWithFlags = input.ReadUInt32();
|
|
var tile = new TiledMapTile(globalTileIdentifierWithFlags, 0, 0);
|
|
var tileset = map.GetTilesetByTileGlobalIdentifier(tile.GlobalIdentifier);
|
|
var localTileIdentifier = tile.GlobalIdentifier - tileset.FirstGlobalIdentifier;
|
|
TilesetTile = tileset.Tiles.FirstOrDefault(x => x.LocalTileIdentifier == localTileIdentifier);
|
|
}
|
|
}
|
|
}
|