Example #1
0
    public void AddTileLink(GameTile tile)
    {
        if (!_linkedTiles.Contains(tile))
        {
            _linkedTiles.Add(tile);
        }

        if (!tile.ContainsTileLink(this))
        {
            // Link it back
            tile.AddTileLink(this);
        }
    }
Example #2
0
    private IEnumerator LinkTile(GameTile t1, GameTile t2)
    {
        yield return(new WaitForEndOfFrame());

        if (!t1.ContainsTileLink(t2))
        {
            GameObject   link       = Instantiate(tileLinkPrefab, t1.transform);
            LineRenderer linkLine   = link.GetComponent <LineRenderer>();
            Vector2      toPosition = t2.GetComponent <RectTransform>().anchoredPosition - t1.GetComponent <RectTransform>().anchoredPosition;
            linkLine.SetPosition(1, toPosition);

            t1.AddTileLink(t2);
        }
    }