The code for GameManager.cs is as follows:
using UnityEngine;
using System.Collections;
public enum GameState {
menu,
inGame,
gameOver
}
public class GameManager : MonoBehaviour {
public static GameManager instance;
public GameState currentGameState = GameState.menu;
public Canvas menuCanvas;
public Canvas inGameCanvas;
public Canvas gameOverCanvas;
void Awake() {
instance = this;
}
void Start() {
currentGameState = GameState.menu;
}
//called to start the game
public void StartGame() {
PlayerController.instance.StartGame();
SetGameState(GameState.inGame);
}
//called when player die
public void GameOver() {
SetGameState(GameState.gameOver);
}
//called when player decide to go back to the menu
public void BackToMenu(...