I remember doing this, the tutorial is programmed incorrectly but it's never addressed. My solution was:
- give each tile an int variable "color number"
- set "color number" to match the right color the tile starts on (i ditched the random start color, and just set it to a color myself for each tile)
- increment "color number" when you step on tile and increment the actual color
- if "color number" is bigger than 5 (if we have 5 colors), then set it to 1 (basically "clamping" it between 1 and 5)
- make a global bool variable for each tile (tile X correct?) *X = 1/2/3/4 depending on tile
- if green is the 3rd color in your sequence, and you want all tiles to be green to win. then check "color number" = 3 after you increment the color and "color number". If so, then set "tile X correct" (X = the tile we're programming)
- listener uses "bool all true" and says you win if all tiles are correct
So if your color sequence is: red, blue, green, yellow.
And a tile starts yellow, you set its "color number" to 4.
If "color number" = 5, then set "color number" to 1. (so it cycles between 1-4 each time its stepped on)
Once you have the basic tile prefab programmed with the functionality, you'll need to drop that prefab down a few times, then edit it in "scene view" to break prefab connection, so you can set starting "color", "color number" (which matches up to color), and also the global bool "tile X correct?" (where if this is tile 1 you're placing, then set it to "tile 1 correct?"
** It's really hacky but i didn't want to spend long on this, after having learnt what it intended (random values and bool checks)
Keep on pushing through problems, you run into a lot when programming.. but the frustration is worth the tools you'll build, giving you the ability to bring life to your own ideas