G
G
Gregory2562022-01-27 17:44:49
C++ / C#
Gregory256, 2022-01-27 17:44:49

How to make a store in unity with two-dimensional arrays?

Good day, I’ll say right away, I know how to make a store, I want to modify it. The bottom line is that during the game, under a certain condition with an object, the player changes the skin, not the color, but the skin or sprite, more precisely. It turns out that when buying one skin, the second one is automatically bought. A two-dimensional array hangs in the brains. However, I don't understand how to implement this. There is an idea in the player's script to prescribe a condition, they say, when buying skin 1, turn on 1.1 when the condition is met. But the script will grow very much. Although I may be wrong, by solving I see switch.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nekit Medvedev, 2022-01-28
@Gregory256

I don't get it, what's with the 2D array? Do you have skins divided by body parts? I would make a separate class for the body part, and the store would pass it to the hero, ideally there should be a separate object (component) that manages the player's skins and has a list of them (in case the player decides to change it during the game), namely this object (component) should be accessed by the store, adding the skin to its pool.
Well, or if you use a two-dimensional array (the first number determines the class of the object (helmet), the second determines the number of the skin in the pool), you can store not skins, but numbers by which they can be found.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question