Texel 7034c1d662 Single tile drawing and tile drawer staging, tile drawer object is dynamically setup with proper hideflags
ScriptableObjects are used to store color set data and the general tileset information, for the moment, saved onto the prefab
2023-01-26 07:40:47 -05:00

36 lines
943 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "TileSetInfo", menuName = "Gameplay/TileSetInfo", order = 1)]
public class TileSetInfo : ScriptableObject {
[Header("Per-color settings / setup")]
public TileObject[] Tiles;
Dictionary<TileColor, TileObject> _TileLookup;
void BuildLookup() {
_TileLookup = new Dictionary<TileColor, TileObject>();
foreach (var tile in Tiles)
_TileLookup.Add(tile.color, tile);
}
public TileObject this[TileColor tc] {
get {
if (_TileLookup == null) BuildLookup();
bool exists = _TileLookup.TryGetValue(tc, out TileObject to);
if (exists) return to;
return null; // return null if we don't got anything
}
}
[Header("Layered")]
public Sprite IceOverlay;
public Sprite FairyUnderlay, Tanuki;
[Header("Special tile sprites")]
public Sprite Rock;
public Sprite Seal, Bomb, Dynamite, Mystery, Spark, Explosion;
}