Game Development Reference
In-Depth Information
// Current health of the boss
public int health = 20;
// Health to start the boss at whenever the battle
begins
private int startHealth = 20;
// Used to determine if the boss has been defeated
private bool isDead = false;
// How many enemies left to kill before the boss is
spawned
private int enemiesLeftToKill = 0;
Note that in the following OnEnable and OnDisable functions, we're using all
existing events. This reuse is part of their power—events can be continuously
reused to check the same actions!
void OnEnable()
{
bulletColliderListener.hitByBullet +=
hitByPlayerBullet;
EnemyControllerScript.enemyDied += enemyDied;
}
void OnDisable()
{
bulletColliderListener.hitByBullet -=
hitByPlayerBullet;
EnemyControllerScript.enemyDied -= enemyDied;
}
void Start()
{
transform.position = inActiveNode.transform.position;
enemiesLeftToKill = enemiesToStartBattle;
}
void Update()
{
switch(currentEvent)
{
 
Search WWH ::




Custom Search