Skip to content

Commit

Permalink
add new int value for tile id
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammin committed Apr 29, 2024
1 parent 73f9314 commit 36818e7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Assets/LDtkUnity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
- Added implicit operator to string for `LDtkIid`
- Added new helper function `LDtkTilesetTile.GetEnumTagValues` to parse the tile's string fields into enum data

- Added new `TileId` int value to `LDtkTilesetTile`

- Total new ScriptableObjects
- LDtkDefinitionObjectAutoLayerRule
- LDtkDefinitionObjectAutoLayerRuleGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ private LDtkArtifactAssetsTileset MakeAndCacheArtifacts(TextureGenerationOutput
newTilesetTile.name = spr.name;
newTilesetTile._sprite = spr;
newTilesetTile._type = GetColliderTypeForSprite(spr);
newTilesetTile._tileId = i;
newTilesetTile.hideFlags = HideFlags.None;
if (customData.TryGetValue(i, out string cd))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public sealed class LDtkTilesetTile : TileBase
{
[SerializeField] internal Sprite _sprite;
[SerializeField] internal Tile.ColliderType _type = Tile.ColliderType.None;
[SerializeField] internal int _tileId;

[SerializeField] internal List<string> _enumTagValues = new List<string>();
[SerializeField, TextArea(1, 200)] internal string _customData = string.Empty;
Expand All @@ -31,9 +32,10 @@ public sealed class LDtkTilesetTile : TileBase

public Sprite Sprite => _sprite;
public Tile.ColliderType Type => _type;
public int TileId => _tileId;

/// <summary>
/// The enum tag values as strings. Opt to use <see cref="GetEnumTagValues{TEnum}"/> to get them formatted as it's enum-typed values
/// The enum tag values as strings. Opt to use <see cref="GetEnumTagValues{TEnum}"/> to get them formatted as enum-typed values
/// </summary>
public IReadOnlyList<string> EnumTagValues => _enumTagValues;
public string CustomData => _customData;
Expand Down

0 comments on commit 36818e7

Please sign in to comment.