final commit?
This commit is contained in:
parent
0e2a7cc7c3
commit
3f53e2caa8
59 changed files with 3989 additions and 1668 deletions
|
|
@ -31,27 +31,27 @@ public class GameManager : MonoBehaviour
|
|||
public string accuracy;
|
||||
public int livesLost;
|
||||
[Header("Pause UI")]
|
||||
[SerializeField] private GameObject pauseMenu;
|
||||
|
||||
public bool canPause = true;
|
||||
public bool isEndless = false;
|
||||
[Header("Game Over")]
|
||||
[SerializeField] private DialogueScript winCutscene;
|
||||
[SerializeField] private GameObject loseUI;
|
||||
[SerializeField] private StatsUI statsUI;
|
||||
private bool gameOver;
|
||||
public bool gameOver;
|
||||
|
||||
public void EndGame()
|
||||
{
|
||||
SetPause(true);
|
||||
gameOver = true;
|
||||
canPause = false;
|
||||
time = TimeSpan.FromSeconds(Time.timeSinceLevelLoad).ToString(@"mm\:ss");
|
||||
wave = WaveManager.instance.wave-1;
|
||||
WaveManager.instance.musicSource.Stop();
|
||||
accuracy = ((float)projectilesHit / projectilesShot).ToString(@"P");
|
||||
}
|
||||
public void LoseGame()
|
||||
{
|
||||
loseUI.SetActive(true);
|
||||
WaveManager.instance.loseUI.SetActive(true);
|
||||
EndGame();
|
||||
statsUI.SetUI();
|
||||
WaveManager.instance.statsUI.SetUI();
|
||||
}
|
||||
|
||||
public void WinGame()
|
||||
|
|
@ -65,23 +65,41 @@ public class GameManager : MonoBehaviour
|
|||
{
|
||||
LevelSwitcher.instance.SwitchLevel(0);
|
||||
SetPause(false);
|
||||
canPause = true;
|
||||
ClearStats();
|
||||
}
|
||||
|
||||
public void RestartGame()
|
||||
{
|
||||
LevelSwitcher.instance.SwitchLevel(1);
|
||||
canPause = true;
|
||||
SetPause(false);
|
||||
ClearStats();
|
||||
}
|
||||
|
||||
public void ContinueGame()
|
||||
{
|
||||
gameOver = false;
|
||||
loseUI.SetActive(false);
|
||||
canPause = true;
|
||||
WaveManager.instance.loseUI.SetActive(false);
|
||||
SetPause(false);
|
||||
WaveManager.instance.musicSource.Play();
|
||||
WaveManager.instance.player.health = WaveManager.instance.player.maxHealth;
|
||||
continues++;
|
||||
}
|
||||
|
||||
private void ClearStats()
|
||||
{
|
||||
continues = 0;
|
||||
wave = 0;
|
||||
projectilesHit = 0;
|
||||
projectilesShot = 0;
|
||||
accuracy = "";
|
||||
deflections = 0;
|
||||
livesLost = 0;
|
||||
time = "";
|
||||
}
|
||||
|
||||
public void SetPause(bool state)
|
||||
{
|
||||
if (state)
|
||||
|
|
@ -96,16 +114,16 @@ public class GameManager : MonoBehaviour
|
|||
|
||||
public void SetPauseMenu()
|
||||
{
|
||||
if (!gameOver && !DialogueManager.instance.dialogueActive)
|
||||
if (!gameOver && canPause && WaveManager.instance)
|
||||
{
|
||||
if (!pauseMenu.activeSelf)
|
||||
if (!WaveManager.instance.pauseMenu.activeSelf)
|
||||
{
|
||||
pauseMenu.SetActive(true);
|
||||
WaveManager.instance.pauseMenu.SetActive(true);
|
||||
SetPause(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
pauseMenu.SetActive(false);
|
||||
WaveManager.instance.pauseMenu.SetActive(false);
|
||||
SetPause(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue