-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix misc. bugs + code improvements #61
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Placing code for initializing things like component references, in the `Awake()` method, follows best practice. Also moved other code related to this setup code, closer to where it's defined, like delegate subscription methods and the `OnDestroy()` method (which largely contains the opposite logic to that of `Awake()`).
E.g. after the base has been destroyed, which automatically restarts the game.
...in `Dahl_Player.prefab`.
Or, in other words, after letting go of the `Select` button without having selected anything.
...as it's not part of the "task" of that method, which is to simply instantiate the construction tower.
Also removed storing the same data twice, by replacing the `PlayerUi.selectedSegment` field with getting the selected segment from UIControllerWheel.
...which caused the "scale down" animation to play when reopening the tower construction wheel, after having previously selected a tower to build.
...which caused the construction tower to be visible at the world origin for a few frames after selecting it from the radial menu.
This was made apparent when looking towards and moving too close to an existing tower, while in building mode, which caused exceptions to be thrown.
Scripts are usually the components that are most used/tweaked, and so it's a useful convention to place all scripts at the top of component lists.
Also renamed `Players` folder to `PlayerCharacters`.
Fueredoriku
approved these changes
Nov 24, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very nice! Read through changed code and tested in-game, everything works as it should.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bugfixes:
EnemyManager
exception when restarting the game (a81277e)FREE
after letting go of theSelect
button without having selected anything (ad4b9fd)Other improvements:
TowerConstructor
script (80b15cb)