Home Game Development unity – How to handle my nested Level Data so {that a} singleton Level Manager can simply increment by Levels

unity – How to handle my nested Level Data so {that a} singleton Level Manager can simply increment by Levels

0
unity – How to handle my nested Level Data so {that a} singleton Level Manager can simply increment by Levels

[ad_1]

I’m making a singleton Level Manager for my Unity phrase recreation, and unsure learn how to construction the info/code.

In my recreation, there are phrase puzzles organized right into a 4-level organizational construction:

  • Realms (there are 6 realms)
  • Areas (there are 5 areas within the first realm)
  • Levels (there are 8 ranges within the first Area)
  • Words (there are 12 Word puzzles within the first degree)

I’ve Scriptable Objects for every degree within the organizational construction, and every part may be very simple to handle and intuitive. This is very necessary, as others might find yourself designing and including the Word Puzzles.

Now I’m programming a Level Manager singleton. I’ll begin the person in Realm 1, Area 1, Level 1, Word 1… and in the event that they end it, they’ll go on to the following Word (Realm 1, Area 1, Level 1, Word 2)… and so on.

If all of the Words have been organized in a single flat desk, the Level Manager singleton could be trivial. I might simply have a Word Number for every phrase, and increment it by one upon profitable completion of the Word Puzzle.

But since my Words are organized into this nested organizational construction, I’ve to loop by all 4 tiers of the organizational construction so as to discover the following degree to go to. It’s not a giant deal at first, however the recreation can have round 5000 phrases upon launch and so it looks like a number of pointless looping!

So far, I can see 2 methods to deal with this:

  1. On Start, I might loop by all 4 ranges of the organizational construction and generate a flat List of Words. Then it might be trivial to increment by the Words.
  2. I might create a backend button and if I click on on it, it might loop by all 4 ranges of the organizational construction and generate a flat List of phrases. It would then Save that listing, in order that it does not should be generated upon runtime every time.

But each of those approaches really feel a bit kludge-y to me. The first one would run each time this system is run, and the second would require me to recollect to re-bake a brand new flat List of Words each time I add a brand new one.

Is there a extra elegant method I could possibly be storing/incrementing by the Word Puzzles? Thanks!

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here