Exemplo n.º 1
0
    public static GameObject CreateRoom(GraphNode node, Transform transform)
    {
        GameObject prefab;

        switch (node.type)
        {
        case NodeTypes.CHEST:
            prefab = Creator.ChestRoom;
            break;

        case NodeTypes.INVERSE_DRAFT:
            prefab = Creator.InverseDraftRoom;
            break;

        case NodeTypes.SOUL:
            prefab = Creator.SoulRoom;
            break;

        case NodeTypes.SHOP:
            prefab = Creator.ShopRoom;
            break;

        default:
            prefab = Creator.BattleRoom;
            break;
        }
        GameObject     instance = Instantiate(prefab, transform);
        MapIcon        mapIcon  = instance.GetComponent <MapIcon>();
        SpriteRenderer sr       = mapIcon.GetComponent <SpriteRenderer>();

        if (node.hidden)
        {
            sr.sprite = Creator.MysteryRoomSprite;
        }
        sr.sortingOrder = 2;
        mapIcon.Init(node);

        return(instance);
    }