Hello,
I am creating a racing game and have checkpoints on my track to track the winning car. When a car passes a checkpoint, a variable named score increases by 1. I have four cars. I would like to have a database (in the game, not SQL), which keeps track of the car’s name (stored in a variable called ‘name’) and its score. How would I do that?
Every frame I would like to look for the highest score and return the name of the car, with the highest score. The database should be a separate game object with its own script. It will be found by a tag called ‘database’.
string name = "car1";
int score = 17;
string name = "car2";
int score = 29;
string name = "car3";
int score = 31;
string name = "car4";
int score = 19;
I think that some kind of dictionary would do the job, but I don’t know how to use one. Can somebody help?