Boss Spawn Sequence Part 1

Prepare for an exciting boss fight

Tristan Engel
2 min readAug 1, 2021

In this article we did various things to improve our boss spawn sequence.

Spawn Manager Script Update

We added a detection to spawning the boss on a certain wave. At the same time it also instantiates the BossText prefab to display the text on the screen. This prefab is instantiated as a child of Canvas.

private void NextWave()
{
_waveNumber++;

if (_waveNumber == _bossWave)
{
GameObject newBossUIText = Instantiate(_bossUIText, _canvas.transform.position, Quaternion.identity);
newBossUIText.transform.SetParent(_canvas.transform);
Instantiate(_boss, _bossSpawnPos, Quaternion.identity);
}

Boss Text Prefab

The Boss Text prefab displays a flickering “BOSS INCOMING” text on the screen. It also has a looping Alarm SFX on it self and stops the normal Background_Music for added immersion.
After a few seconds the prefab self destructs.

Boss Text Script

private float _timer = 3.5f;
private float _flicker = 0.5f;
private float _nextFlicker = 0f;
private Text _bossText;
private string _text;

//handles
private GameObject _bgm;

void Start()
{
_bgm = GameObject.Find("Background_Music");
_bgm.SetActive(false);

Destroy(gameObject, _timer);
_bossText = GetComponent<Text>();
_text = _bossText.text;
}

void Update()
{
if (Time.time > _nextFlicker)
{
_nextFlicker = Time.time + _flicker;
if (_bossText.text == "")
{
_bossText.text = _text;
}
else
{
_bossText.text = "";
}
}
}

--

--

Tristan Engel
Tristan Engel

Written by Tristan Engel

Aspiring developer that’s self-learning Unity & C# to transition to a career with Unity. I got a passion for creating interactive experiences.

No responses yet