Skip to content
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
merged 23 commits into from
Nov 24, 2021
Merged

Fix misc. bugs + code improvements #61

merged 23 commits into from
Nov 24, 2021

Conversation

ddabble
Copy link
Member

@ddabble ddabble commented Nov 24, 2021

Bugfixes:

  • Fixed EnemyManager exception when restarting the game (a81277e)
  • Fixed not setting player state to FREE after letting go of the Select button without having selected anything (ad4b9fd)
  • Fixed wheel segment scaling animation not finishing (f40b00f)
  • Fixed not initially setting construction tower position (f4b74b9)
  • Fixed not always focusing on held interactable (6c57a2d)
  • Fixed placing more than one tower on a single cell (930e6e3)

Other improvements:

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.
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 Fueredoriku self-assigned this Nov 24, 2021
Copy link
Collaborator

@Fueredoriku Fueredoriku left a 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.

@ddabble ddabble merged commit 712105c into develop Nov 24, 2021
@ddabble ddabble deleted the fix/misc branch November 24, 2021 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants