Make simple(or not) score list
I have few "bots" and player, each has their score. I need to make score list that would contain each bot and player name with their scores. Score updates of course and Names are random. I've searched a lot and didn't find anything that could help me. Except for dictionaries, but i just can't figure how they work. I don't need a code i just want to know what method i could use.
Answer by GamitusLabs · Oct 15, 2018 at 04:30 PM
Are they all derived from a base class?
Player : BaseClass
Bot : BaseClass
BaseClass { Name, Score }
If so, you can just grab them at run-time and stick them in a couple lists/arrays:
BaseClass[] players = GetComponents()
string[] names = new string[players.length]
int[] scores = new string[players.length]
for each player -> into corresponding array
This is basically how a dictionary works, the names would be your key, the scores would be the value (key/value pairs)