Permalink
Cannot retrieve contributors at this time
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?
SpaceShooter/SpaceShooter/Assets/Scripts/Enemy Game Controllers/GameController_Boss.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
61 lines (47 sloc)
1.38 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} | |
} |