Summary
In this chapter, you mainly learned how to improve the quality of the code in the Pangaea project, as well as how to output debug messages to monitor real-time game information.
Firstly, we introduced the concepts of code refactoring and code refinement, which made you aware of the importance of regular code quality improvement.
After that, we analyzed the Pangaea source code and identified two main issues that could be overcome: the redundant two animation instance classes of UPlayerAnimInstance
and UEnemyAnimInstance
and the duplicated member variables and functions of APlayerAvatar
and AEnemy
.
To resolve the first issue, you added a new class, UPangaeaAnimInstance
, to replace the existing UPlayerAnimInstance
and UEnemyAnimInstance
classes. To resolve the second issue, you made the APangaeaCharacter
class the parent class of APlayerAvatar
and AEnemy
, so that the duplicated variables and functions could be moved into the parent class.
Then, improving the code performance...