/// <summary> /// Cleans up XML lists, sets paused status to false, loads main menu /// /// Autor: David Askari, Courtney Chu, Cole Twitchell /// </summary> public void RestartGame() { XmlImporter.Cleanup(); PauseGame.Status = false; GameObject.Find("GameManager").GetComponent <SceneLoader>().LoadScene("main_menu"); }
/// <summary> /// Updates times and other necessary pieces of game play. /// /// Authors: Amy Lewis, Cole Twitchell, David Askari, Steven Johnson, Courtney Chu /// </summary> public void Update() { SetTimerText(); WaveManager.Update(); var saturation = ppProfile.colorGrading.settings; if (currentWave == 1) { saturation.basic.saturation = 1; } else if (currentWave == 6) { sendBossButton.SetActive(true); PauseGame.sendBossButton = sendBossButton.GetComponent <SendBossButton>(); } if (gameOver) { waveTimer.SetPaused(true); if (CastleManager.CastleHealth > 0) { saturation.basic.saturation = 0; } PauseGame.Status = true; GameObject.Find("OptionsMenu").SetActive(false); GameObject.Find("OptionsButton").GetComponent <Button>().interactable = false; sendBossButton.GetComponent <SendBossButton>().DisableButton(); if (CastleManager.CastleHealth > 0) { XmlImporter.Cleanup(); PauseGame.Status = false; SceneManager.LoadScene("victory_cutscene"); } else { gameOverObject.transform.Find("GameOverText").GetComponent <Text>().text = "GAME OVER"; gameOverObject.SetActive(true); enabled = false; } } else { if (!waveTimer.IsPaused() && waveTimer.IsDone()) { waveTimer.SetPaused(true); WaveManager.BeginWave(); AudioManager.PlayBeginWaveSound(); sendBossButton.GetComponent <SendBossButton>().DisableButton(); } if (WaveManager.WaveFinished() && EnemyManager.EnemiesRemaining() <= 0) { saturation.basic.saturation = 1.0f - ((float)(currentWave - 1) / (float)totalWaves); currentWave++; waveText.text = currentWave.ToString(); waveTimer.Reset(); waveTimer.SetPaused(false); WaveManager.SetNextWave(); skipTimeButton.interactable = true; sendBossButton.GetComponent <SendBossButton>().ResetButton(); } if (Hover.IsActive()) { GameManager.rangeIndicatorRenderer.transform.position = Hover.GetPosition(); } if (Input.GetKeyDown(KeyCode.S)) { GameManager.AddMoney(100); } if (Input.GetKeyDown(KeyCode.A)) { SkipTimer(); } else if (Input.GetMouseButtonUp(1) && Hover.IsActive()) { GameManager.rangeIndicatorRenderer.enabled = false; Hover.Deactivate(); GameManager.ResetTower(); TowerInformation.Reset(); } } ppProfile.colorGrading.settings = saturation; healthText.text = CastleManager.CastleHealth.ToString(); moneyText.text = money.ToString(); errorTextTimer.Update(); if (errorTextTimer.IsDone()) { errorText.gameObject.SetActive(false); errorTextTimer.Reset(); errorTextTimer.SetPaused(true); } }