A
A
Alex Kolyhov2021-06-10 22:35:32
C++ / C#
Alex Kolyhov, 2021-06-10 22:35:32

How to implement Unity combinations?

Hello!
I'm making a game of "Dice" and I have a question: how to make the game have combinations?

60c2679fb7e84091322649.png

Look, here is a table with 6 dice, and the player can choose from one to six pieces, and the game should automatically add combinations of them and add points to the player. Combinations in the game, such as 3 fives, 4 triples, 5 units, etc., as well as for one or two units or five, the player also receives points. It is also worth considering that when you click on the cube again, the selection from it disappears. And also the player can choose them in any order, let's say: 3, 3, 1, 5, 3, and the game should see in this: 3, 3, 3, then 1 and then another 5. Please tell me how can I implement This? It’s just that it’s extremely stupid to do this through the usual if else, but I can’t think of anything else.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GFX Data, 2021-06-12
@ShockWave2048

There is a grouping in the Linq.Net extension, you need to do it by value.
On the left, you can see the output structure, a set of arrays sorted by length.
60c4d518028d2133413594.jpeg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question