IEnumerator StartNewGame() { _uiManager.ToggleLoadingScreen(true); yield return(new WaitForSeconds(1f)); LeftBoard.TogglePlayer(false); RightBoard.TogglePlayer(false); _uiManager.PreGameScreen.SetActive(false); _uiManager.GameBoardScreen.SetActive(true); LeftBoard.ResetValues(true); RightBoard.ResetValues(true); List <PlayCard_script> pcs = new List <PlayCard_script>(); pcs.AddRange(LeftBoard.DiscardPile.GetComponentsInChildren <PlayCard_script>()); pcs.AddRange(LeftBoard._mainCardBoard.GetComponentsInChildren <PlayCard_script>()); pcs.AddRange(LeftBoard._handCardBoard.GetComponentsInChildren <PlayCard_script>()); pcs.AddRange(RightBoard._mainCardBoard.GetComponentsInChildren <PlayCard_script>()); pcs.AddRange(RightBoard._handCardBoard.GetComponentsInChildren <PlayCard_script>()); foreach (PlayCard_script pc in pcs) { pc.DestroyCard(); } //screen transition etc yield return(new WaitForSeconds(1f)); GenerateDecks(); yield return(new WaitForSeconds(1f)); DetermingStartingPlayer(); _uiManager.ToggleEndScreen(false, false); _uiManager.ResetUI(); GameStage = 1; StartGame(); _uiManager.ToggleLoadingScreen(false); }
IEnumerator StartNewRound() { _uiManager.ToggleEndScreen(false, false); List <PlayCard_script> pcs = new List <PlayCard_script>(); pcs.AddRange(LeftBoard.transform.GetChild(0).GetComponentsInChildren <PlayCard_script>()); pcs.AddRange(RightBoard.transform.GetChild(0).GetComponentsInChildren <PlayCard_script>()); //sound effect foreach (PlayCard_script pc in pcs) { pc.RemoveCard(); } LeftBoard.ResetValues(false); RightBoard.ResetValues(false); yield return(new WaitForSeconds(1.1f)); //screen transition etc StartGame(); }