Skip to content
Permalink
3a9b3694ac
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
61 lines (47 sloc) 1.38 KB
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameController_Boss : MonoBehaviour
{
public GameObject hazard_BOSS;
public Vector2 spawnValues_BOSS;
public int hazardCount_BOSS;
public float spawnWait_BOSS;
public float startWait_BOSS;
public float waveWait_BOSS;
void Start()
{
StartCoroutine(SpawnWaves());
}
IEnumerator SpawnWaves()
{
yield return new WaitForSeconds(startWait_BOSS);
while (true)
{
for (int i = 0; i < hazardCount_BOSS; i++)
{
Vector2 spawnPosition = new Vector2(Random.Range(-spawnValues_BOSS.x, spawnValues_BOSS.x), spawnValues_BOSS.y);
Quaternion spawnRotation = Quaternion.identity;
Instantiate(hazard_BOSS, spawnPosition, spawnRotation);
yield return new WaitForSeconds(spawnWait_BOSS);
}
yield return new WaitForSeconds(waveWait_BOSS);
}
}
//By level Boss Update
void Update()
{
if (ScoreScript.scoreValue < 999)
{
hazardCount_BOSS = 0;
spawnWait_BOSS = 0;
waveWait_BOSS = 0;
}
if (ScoreScript.scoreValue >=1000)
{
hazardCount_BOSS = 1;
spawnWait_BOSS = 6000;
waveWait_BOSS = 0;
}
}
}