I have a pool of 30 models I need to keep track of which are active through several levels.
Level 1 I need to check which models are active, subtract those from the pool of 30, and instantiate the rest that aren't activated yet.
The activatedModels are stored in a comma separated string which is available to each level. When a new model is activated, I simply append it's number to the string and destroy the model. Each unique model has a number 0-29. The "activated" string for activated models looks like "6,1,4,3,19,14,"
On Level 2, I load models that have been activated but not the rest. I get the string of activated models from level 1, split it at the commas, and instantiate the models by number. Insantiate model #6, #1, #4, #3, #19, #14, etc
So now on level 1, I have 2 arrays, array1 has the entries "6,1,4,3,19,14," array2 has entries 0,1,2,3,...,29,
I need to subtract matching entries between array1 and array2, then instantiate the models of the remaining entries, but not instantiate models that are already activated....
Any tips for what methods would help are appreciated. Do I loop through and make a comparison between all entries in both arrays, and subtract entries, or loop through and store non matching entries in a 3rd array? I got most of it done as far as parsing the string, adding activated numbers, etc but just not separating out the already activated from the large pool of available models to spawn them on level 1...