I
I
idpopeye112019-04-28 21:45:56
C++ / C#
idpopeye11, 2019-04-28 21:45:56

How to record the characteristics of several characters?

I am a complete newbie to C#. I am currently doing a project. But knowledge is not enough! Tell me what to read!
My project has a character creation window. The player chooses 1 of 4 classes and enters his name. after which it will spawn in a new scene with that class and name. Up to 12 characters can be created this way. The problem is that they must all have their own characterizations and names. Sometimes you need to create 5 characters, sometimes 12.
For example.
Character 1: (class) warrior; (name) Alexander; (level)1; (amount of experience 0/100)
Character 2: (class) knight; (name) Peter; (level)2; (the amount of experience is 10/100)
and so on. How to save it through serialization is another question. then I'll ask.
Now I'm wondering how to collect information for each character and change it if necessary, by clicking on the UI buttons (I click on the button and character1 adds 10 experience. In the List to collect information on the character? If yes, then you need to make a List for each character? and how vary the number of these sheets depending on the number of characters created a minute ago? If not, then how is it different? Where to read about it, what to see? I
leave a link to a demonstration of what it should represent
link to google drive

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Gaydak, 2019-04-29
@idpopeye11

"variate the number of these sheets depending on the number of characters created a minute ago"
now this is some kind of mess in your head.
Try it apart from the game and the characters. do some data storage.
For starters, something very simple and abstract. The same list of characters, but the characters have ONLY a NAME, for example.
What in such a simplified situation prevents the creation of 12 names? or 5 out of 12?
and by the number in the list to get data about the character (name) is also not a problem in theory?
I hope no.
And now, in addition to the name, the character has an AGE parameter. i.e. not a list of string NAME.
A list consisting of MyCLASSorSTRUCT elements (its own class with the necessary fields inside)
If there are problems here - go ahead to Google to read something about it))
conditionally something in the spirit of
https://dzone.com/articles/different-ways-of-creat...
https://www.c- sharpcorner.com/UploadFile/mahesh/cr...
Then if the whole thing is to save and save to upload, then read about data serialization. in the same Json should be quite convenient. on request ala "unity save object in json" somehow there is something))
and there already with more specific problem areas (if any) - with new questions on the toaster))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question