Connect at least three tiles to gain points
For best experience, use fullscreen
The level scriptable object holds the level information: The grid size, target score and max moves.
These are then used in the GameManager to actually load the game.
The Game manager holds and loads all the levels in the game.
It's also there where we set the score per tile and check win/loss-state.
The grid is structured with empty slots and then filled with tiles. The size of the grid is set by a scriptable object in the game manager.
This script takes care of updating the field by shifting the tiles down on the board and repopulates it with new tiles.
It also calculates the max distance between tiles, so the player cannot choose a tile that is more than one tile away from the current.
The tiles have a TileType assigned to them, giving them a distinct colour. The tiles get inactivated when you pick it up and enables when we spawn it in again. Every time a tile spawns in, they get a new colour.
The tile gives auditory and visual feedback when being selected and picked upped.
To be able to select the tiles we want, we use a raycast to see what's under our mouse. We need to check the distance with the next tile so the player can't choose one too far away, using the MaxDistance float from Grid.
All selected tiles get added to a list in which we later loop through to clear them from the board.
The player can also cancel their current link by pressing the right mouse button.
The sound manager takes care of playing the select and popping-tile sounds.
I wanted to change the pitch for the select sound, so I raise the pitch to the max and then lower it again when playing the tile-pop sound.
In this manager, we activate and deactivate prompts like the Next level prompt or the Exit game prompt.
We also disable player input on the board so the player can't play in on of the menus.