Exemplo n.º 1
0
    public MapIcon CreateMapIcon(Sprite iconSprite, Vector2 size, Vector3 worldPosition, bool keepOnMap, float rangeSize,
                                 MapIconType iconType, bool removeAble, string textToDisplay = "")
    {
        if (!UI || !UI.gameObject || !iconSprite)
        {
            return(null);
        }
        MapIcon icon = ObjectPool.Get(UI.iconPrefab.gameObject, SelectParent(iconType)).GetComponent <MapIcon>();

        icon.Init(iconSprite, size, worldPosition, keepOnMap, rangeSize, iconType, removeAble, textToDisplay);
        NormalIcons.Add(icon);
        return(icon);
    }
Exemplo n.º 2
0
    public void CreateMapIcon(MapIconHolder holder)
    {
        if (!UI || !UI.gameObject || !holder.icon)
        {
            return;
        }
        MapIcon icon = ObjectPool.Get(UI.iconPrefab.gameObject, SelectParent(holder.iconType)).GetComponent <MapIcon>();

        icon.Init(holder);
        iconsWithHolder.TryGetValue(holder, out MapIcon iconFound);
        //Icons.Add(icon);
        if (iconFound != null)
        {
            holder.iconInstance     = icon;
            iconsWithHolder[holder] = icon;
        }
        else
        {
            iconsWithHolder.Add(holder, icon);
        }
        return;
    }
Exemplo n.º 3
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);
    }