public void ClearTile() { puzzle = null; tile = null; if (frontface != null) { frontface.sprite = null; } if (button != null) { button.onClick.RemoveAllListeners(); } }
public void SetTile(Tile tile, MatchingPuzzle puzzle) { if (puzzle == null) { return; } if (tile == null) { return; } this.puzzle = puzzle; this.tile = tile; if (frontface != null) { if (tile.Icon != null) { frontface.sprite = tile.Icon; } else { frontface.color = tile.IconColor; } } if (button != null) { button.onClick.AddListener(() => puzzle.Click(this)); } else { Debug.LogError("Button is missing"); } }