On deaf ears

Now that all the Squares know which piece is inside them, we can theoretically poll any square and ask its status. The trouble is that the GameLogic script is only set up to be reactive. The ClickSquare function responds to the player's action of clicking on a square. We need to actively ask a square what's up.

Currently, there's no real way for us to do that, since we haven't created any references to our squares. As we did with the Robot Repair game, it would be really handy to create a two-dimensional array, so that we can refer to Squares by their coordinate addresses. So let's!

Get Unity 4.x Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.