mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-25 01:39:23 +01:00
add a tiled method that doesn't require ushort casts to get tiles
This commit is contained in:
parent
dbe02645f1
commit
84e1958b4e
3 changed files with 7 additions and 3 deletions
|
@ -33,7 +33,7 @@ namespace MLEM.Extended.Tiled {
|
|||
|
||||
public void UpdateDrawInfo(int layerIndex, int x, int y) {
|
||||
var layer = this.map.TileLayers[layerIndex];
|
||||
var tile = layer.GetTile((ushort) x, (ushort) y);
|
||||
var tile = layer.GetTile(x, y);
|
||||
if (tile.IsBlank)
|
||||
return;
|
||||
var tileset = tile.GetTileset(this.map);
|
||||
|
|
|
@ -54,7 +54,11 @@ namespace MLEM.Extended.Tiled {
|
|||
|
||||
public static TiledMapTile GetTile(this TiledMap map, string layerName, int x, int y) {
|
||||
var layer = map.GetLayer<TiledMapTileLayer>(layerName);
|
||||
return layer != null ? layer.GetTile((ushort) x, (ushort) y) : default;
|
||||
return layer != null ? layer.GetTile(x, y) : default;
|
||||
}
|
||||
|
||||
public static TiledMapTile GetTile(this TiledMapTileLayer layer, int x, int y) {
|
||||
return layer.GetTile((ushort) x, (ushort) y);
|
||||
}
|
||||
|
||||
public static RectangleF GetArea(this TiledMapObject obj, TiledMap map, Vector2 position) {
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace MLEM.Extended.Tiled {
|
|||
|
||||
public void UpdateCollisionInfo(int layerIndex, int x, int y) {
|
||||
var layer = this.map.TileLayers[layerIndex];
|
||||
var tile = layer.GetTile((ushort) x, (ushort) y);
|
||||
var tile = layer.GetTile(x, y);
|
||||
if (tile.IsBlank)
|
||||
return;
|
||||
var tilesetTile = tile.GetTilesetTile(this.map);
|
||||
|
|
Loading…
Reference in a new issue