Game Development Reference
In-Depth Information
return targetPosition;
}
void hitByPlayerBullet()
{
health -= 1;
// If the boss is out of health - kill 'em!
if(health <= 0)
killBoss();
}
void createDropFX()
{
GameObject dropFxParticle =
(GameObject)Instantiate(bossDropFX);
dropFxParticle.transform.position =
dropFXSpawnPoint.transform.position;
}
Killing any enemy, boss or regular, is a little delicate. In the case of our standard tank
enemies, we just spawn a particle system and destroy the Enemy object. In the case of
the boss, however, we want to reuse the Boss object. Why? So you can learn how to
reuse an enemy! You're very welcome.
So, what we're going to do here is check whether the enemy is dead, and if not,
generate an emitter, move the boss, and end the battle, using the following code
in the BossEventController script:
void killBoss()
{
if(isDead)
return;
isDead = true;
GameObject deathFxParticle =
(GameObject)Instantiate(bossDeathFX);
// Reposition the particle emitter at the same
// position as dropFXSpawnPoint
deathFxParticle.transform.position =
dropFXSpawnPoint.transform.position;
 
Search WWH ::




Custom Search