예제 #1
0
    // TODO : �ٸ� ������Ʈ�� Ŭ���ϰ� ���ƿ����� ������ ���°� �����Ǹ� ������
    private void OnEnable()
    {
        mapLoader = (MapLoader)target;

        // ���� �����ϴ� ��� Ÿ�ϸ� ����
        tileMaps = FindObjectsOfType <Tilemap>();

        // ���⼭ ������ ��ü ����Ʈ ����
        var itemDatabase = JsonImporter.LoadJsonFile <ItemDatabase>(itemDataPath, "ItemDatabase");

        allItems = itemDatabase.AllItem;

        itemNameList = new List <string>();
        foreach (var item in allItems)
        {
            itemNameList.Add(item.itemName);
        }
    }
예제 #2
0
    private void LoadTileMap(string name, Transform parent = null)
    {
        var o = Instantiate(mapLoader.transform.Find("TileMapEmpty"));

        o.name   = name;
        o.parent = parent;
        var tileMap = o.GetComponent <Tilemap>();

        var data      = JsonImporter.LoadJsonFile <TileMapData>(mapDataPath, name);
        var tileNames = data.tileNames;
        var tilePos   = data.tilePos;
        var length    = tileNames.Count;

        for (int i = 0; i < length; ++i)
        {
            tileMap.SetTile((Vector3Int)tilePos[i], (TileBase)Resources.Load("Tileset/" + tileNames[i]));
        }
    }