public void Awake() { if (gameControl == null) { DontDestroyOnLoad(gameObject); gameControl = this; } else if (gameControl != this) { Destroy(gameObject); } ui = GetComponent <UIController> (); dialog = GetComponent <DialogController> (); gameEnd = GetComponent <GameEndHandler> (); stage = GetComponent <StageHandler> (); scene = GetComponent <SceneHandler> (); enemySpawner = GetComponent <EnemySpawner> (); spriteLib = GetComponent <SpriteLibrary> (); enemyLib = GetComponent <EnemyLib> (); pause = GetComponent <PauseController> (); stats = GetComponent <PlayerStats> (); sound = soundObject.GetComponent <SoundController> (); menu = GetComponent <MenuController> (); menu.InitMenu(); sound.InitSound(); scene.CheckScene(); }
void DisplayEndScreen(int win) { if (win == 0) { Debug.Log("<color=magenta>Both sides lost. It's a draw!</color>"); endHandler = Object.Instantiate(battleManager.gameDrawCardPrefab, battleManager.transform); endHandler.onButtonClicked += OnReplay; } else if (win == 1) { Debug.Log("<color=magenta>Human player won the battle!</color>"); endHandler = Object.Instantiate(battleManager.gameWonCardPrefab, battleManager.transform); endHandler.onButtonClicked += OnReplay; battleManager.nPCDisplay.SetReaction(npcData.battleLoseQuotes[Random.Range(0, npcData.battleLoseQuotes.Length)], npcData.enemyAngry); } else if (win == 2) { Debug.Log("<color=magenta>Computer player won the battle!</color>"); endHandler = Object.Instantiate(battleManager.gameLostCardPrefab, battleManager.transform); endHandler.onButtonClicked += OnReplay; battleManager.nPCDisplay.SetReaction(npcData.battleWinQuotes[Random.Range(0, npcData.battleWinQuotes.Length)], npcData.enemyAngry); } else { // this is an error case and should never occur Debug.Log("<color=red>Game Error: No winner could be determined!</color>"); } }