O
O
Oleg Efremov2018-11-20 14:34:02
Unity
Oleg Efremov, 2018-11-20 14:34:02

To move or not to move the object (if not in three or more rows)?

Three in a row game. I started learning Unity, I don't know much yet.
When moving (screen) 1 object to 2 object, it will find a match and the fruit will fall down.
Implement such a condition: when moving (screen) 3 objects to 4 objects, it does not find a match and should not move these fruits (or move them back).

Screen
5bf5043da971b393187833.png

Here is a piece of code where the main function occurs when the mouse is pressed.
spoiler
.....
if (GetAllAdjacentTiles().Contains(previousSelected.gameObject))
                {
          SwapSprite(previousSelected.render);
          previousSelected.ClearAllMatches();
          previousSelected.Deselect();
          ClearAllMatches();
        }
                else
                {
          previousSelected.GetComponent<Tile>().Deselect();
          Select();
        }
.......

Here is the link where the game came from
spoiler
wnfx.ru/kak-sozdat-igru-v-unity

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel, 2018-11-20
@youkerni

Reread your question and edit it, please. I re-read it 3 times and still do not understand what you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question