TrianglePuzzleGameThis example shows the basic principles of implementing certain mechanics:

The example also shows some basic grids idioms:

This example uses the same cells for the board and pieces. In retrospect, it may have been better to use separate cells. In this simple example it does not make a big difference, but if you have more complicated game logic, it is worth considering whether separate cells would be better.

Another thing to notice is the “architecture” of the cell. Because triangular grids require cells in two orientations, it’s sometimes difficult to make the images exactly right so that they will align properly in the grid. For this reason we added a pivot node, which is used for rotating the cell, and a offset, which is used to move the visual part of the cell vertically. The offset is parented to the pivot, and all visual elements are parented to the offset.

This is the first time we played with using Grids as prefabs. Although it works well, you have to take care:

Important: When we implemented this example, we discovered a missing feature for alignment which is necessary to implement dragging properly. This package contains updated version of the MapAlignment and TileGridBuilderfiles. (These updates will also be included with the next update of grids).

To run the example:

TrianglePuzzleGame.unitypackage