38 lines
957 B
C#
38 lines
957 B
C#
using UnityEngine;
|
|
using UnityEngine.Tilemaps;
|
|
|
|
namespace GeometryTD.Map
|
|
{
|
|
[DisallowMultipleComponent]
|
|
public class MapDataRefs : MonoBehaviour
|
|
{
|
|
[SerializeField] private Tilemap _tilemap = null;
|
|
[SerializeField] private Spawner[] _spawners = null;
|
|
[SerializeField] private House _house = null;
|
|
|
|
public Tilemap Tilemap => _tilemap;
|
|
public Spawner[] Spawners => _spawners;
|
|
public House House => _house;
|
|
|
|
#if UNITY_EDITOR
|
|
private void OnValidate()
|
|
{
|
|
if (_tilemap == null)
|
|
{
|
|
_tilemap = GetComponentInChildren<Tilemap>(true);
|
|
}
|
|
|
|
if (_spawners == null || _spawners.Length == 0)
|
|
{
|
|
_spawners = GetComponentsInChildren<Spawner>(true);
|
|
}
|
|
|
|
if (_house == null)
|
|
{
|
|
_house = GetComponentInChildren<House>(true);
|
|
}
|
|
}
|
|
#endif
|
|
}
|
|
}
|