Destroying a base defense tower to win the game
To complete the implementation as well as add the IsBase
tower’s designation support for the ADefenseTower
class, we must do the following:
- Add the
IsBase
flag toADefenseTower
. - Modify the
Hit
function so that it deals with the server and client processes when the tower is destroyed. - Add the
GameWin
flag and theOnGameWin
function toAPangaeaGameState
. - Add
OnGameWinLoseDelegate
toAPangaeaGameState
. - Edit the
BP_DefenseTower
blueprint to bindOnGameWinLoseEvent
toOnGameWinLoseDelegate
. - Show win or lose information in the Game Over window.
So, let’s get started. First, open the DefenseTower.h
file and add the IsBase
flag to AdefenseTower
. Then, add the following code:
public:… UPROPERTY(EditAnywhere, Category = "Tower Params") bool IsBase = false;
Next, in DefenseTower.cpp
, modify the Hit
function so that it deals with the server and client processes when the tower...