// Update is called once per frame void Update() { if (isSpawning == false) { if (upcomingPanel == null && delay - (Time.time - curTime) < 10f) { upcomingPanel = panelControl.addPanel(); upcomingPanel.image.sprite = upcomingDisplay; if (type == enemy.TYPE.Addition) { upcomingPanel.description.text = "Type: Addition"; } else { upcomingPanel.description.text = "Type: Subtraction"; } upcomingPanel.timeRemain.text = (delay - (Time.time - curTime)).ToString("0.##"); upcomingPanel.bar.transform.localScale = new Vector3((delay - (Time.time - curTime)) / 10f, 1f, 1f); } else if (upcomingPanel != null) { upcomingPanel.timeRemain.text = (delay - (Time.time - curTime)).ToString("0.##"); upcomingPanel.bar.transform.localScale = new Vector3((delay - (Time.time - curTime)) / 10f, 1f, 1f); } if (Time.time - curTime > delay) { isSpawning = true; curTime = Time.time; panelControl.removePanel(upcomingPanel); spawnEnemy(); } } else { if (Time.time - curTime > spawnRate) { curTime = Time.time; spawnEnemy(); } } }
public void removePanel(upcomingPanel up) { upcomings.Remove(up.gameObject); Destroy(up.gameObject); organizePanels(); }