Class Review


[This devlog has been in my drafts since 2020, I'm publishing it now because why not. I did not end up doing what I discussed in this post because I got a job, which was the goal after all]


Breakdown

Here is a breakdown of some of the problems with each class in the current code.

AudioManager, Sound - Shamelessly taken from Brackeys, perfectly fine for a small number of sounds but requires everything that plays a sound to contain a reference to this class.

GameManager - The logic for the text at the top of each level could be handled by a seperate class, probably a "Level" class that can be instanced for each level and passed about. There are a lot of public singleton references in this class, I immediately found two that were not needed. Also the target points/word win conditions should be publicly accesible but not settable.

LevelGenerator - Will be fully reworked, right mess.

LevelSettings - Would be better loaded in from a file, such as a google sheet, rather than hard coded here. Would quickly be unmanageable for large numbers of levels.

NextLevel, PlayButton - Logic for loading in a next level should be handled by the GameManager parsing the LevelSettings, not in this buttons component.

SubmitButton - Again a bit messy with the number of references, perhaps the GameManager could pass the CheckTray tiles to the SubmitButton, and react to the results. This should really be a single public method "CheckWord", with whatever it needs, that fires off events.

SubmitHistory - Probably could be much cleaner with a better understanding of TextMeshPro character sizes or a fixed-width font.

Tile - This is where the real puzzle is, currently a tile calls the TileManager to unpress itself, this should probably be handled either by the TileManager, or by a new class that just handles what is being pressed and the results.

TileManager - Needs to refactored into a couple of classes. First off the CheckTray should be its own class that handles the tiles to be checked. Secondly the loading of a the level should not be in here, perhaps a seperate class again. Finally this class is sort of a hub of all the cross-references, so this is sort of the knot of all the cross-reference problems. I will have to dig deeper here to seperate the code into more logical sections that don't need to communicate as much.

Also the letter weights could be in a loaded spreadsheet, potentially part of the Level class.

Leave a comment

Log in with itch.io to leave a comment.