////////////////////////////////////////////////////////////////////////// // ChechGameStatus public void ChechGameStatus() { if (m_CurrentPhase == GAMEPHASE.PLAYERS) { foreach (VirtualPlayer player in VirtualPlayer.Players) { if (player.Done == false) { return; } } // Reached this point is the turn of dealer, show hidden card m_CurrentPhase = GAMEPHASE.DEALER; // Reset card is currently dragging Card.Cards.ForEach(( Card c ) => c.OnPhaseChange()); UI.Instance.PrintStatus("Dealer Turn"); Dealer.Instance.Cards[0].Shown = true; GameManager.Instance.ChechGameStatus(); } else // check dealer state { int dealerPoints = Dealer.Instance.Points; if (dealerPoints > 21) { UI.Instance.OnGameEnd("Dealer bust"); return; } if (dealerPoints < 17) { return; } string winners = ""; foreach (VirtualPlayer player in VirtualPlayer.Players) { if (player.CurrentDecision == VirtualPlayer.PlayerDecision.BUST) { continue; } if (player.Points > dealerPoints) { winners += player.name + " "; } } if (winners.Length == 0) { winners = "dealer"; } UI.Instance.OnGameEnd("Winners:\n" + winners); GameManager.GameActive = false; } }
void Awake() { instance = this; gamePhase = GAMEPHASE.START; if (size > 2) { size = 2; } }
void new_phase_started(LOTRGame.GAMEPHASE new_phase) { Debug.Log("new phase started"); cur_phase = new_phase; foreach (LOTRPlayer player in players) { ///player.clear_abilities_on_phase_change(cur_phase); player.new_phase_started(); } }
////////////////////////////////////////////////////////////////////////// // OnReet public void NewRound() { m_WinnerPlayer = null; m_HigherPlayerPoints = 0; GameActive = false; // Reset cards Card.Cards.ForEach(( Card c ) => c.OnReset()); // Reset players VirtualPlayer.Players.ForEach(( VirtualPlayer p ) => p.OnReset()); Dealer.Instance.OnReset(); m_CurrentPhase = GAMEPHASE.PLAYERS; StartCoroutine(RoundStartCO()); }
public void setGamePhase(GAMEPHASE phase) { gamePhase = phase; }
public IEnumerator onNextPhase() { if (gamePhase == GAMEPHASE.START) { gamePhase = GAMEPHASE.PLACEMENT; cam.GetComponent <CC_CrossStitch>().enabled = false; } else if (gamePhase == GAMEPHASE.PLACEMENT) { FadeInText(systemText, "MOVEMENT PHASE", 3f); FadeInText(subText, "Engage!", 2f); gamePhase = GAMEPHASE.MOVEMENT; ResetTile(); yield return(new WaitForSeconds(3)); FadeOutText(systemText, 3f); FadeOutText(subText, 2f); yield return(new WaitForSeconds(3)); } else if (gamePhase == GAMEPHASE.MOVEMENT) { FadeInText(systemText, "ASSAULT PHASE", 3f); FadeInText(subText, "Plan your attacks!", 2f); gamePhase = GAMEPHASE.ATTACK; yield return(new WaitForSeconds(3)); FadeOutText(systemText, 3f); FadeOutText(subText, 2f); yield return(new WaitForSeconds(3)); } else if (gamePhase == GAMEPHASE.ATTACK) { Reset(); gamePhase = GAMEPHASE.PATK; FadeInText(systemText, "ATTACKING", 3f); FadeInText(subText, "Engaging the enemy!", 2f); yield return(new WaitForSeconds(3)); FadeOutText(systemText, 3f); FadeOutText(subText, 2f); } else if (gamePhase == GAMEPHASE.PATK) { FadeInText(systemText, "OPPONENT PHASE", 3f); FadeInText(subText, "----------", 2f); gamePhase = GAMEPHASE.AI; btn.gameObject.SetActive(false); yield return(new WaitForSeconds(3)); FadeOutText(systemText, 3f); FadeOutText(subText, 2f); GetComponent <AiController>().callAi(); yield return(new WaitForSeconds(3)); } else { FadeInText(systemText, "PLACEMENT PHASE", 3f); FadeInText(subText, "Place your units!", 2f); gamePhase = GAMEPHASE.PLACEMENT; SetTileZone(); movement = maxMovement; movementBar.value = movement; btn.gameObject.SetActive(true); yield return(new WaitForSeconds(3)); FadeOutText(systemText, 3f); FadeOutText(subText, 2f); yield return(new WaitForSeconds(3)); } }
public bool move() { SCENERESULT result; switch (mPhase) { case GAMEPHASE.RESET: mPhase = GAMEPHASE.INIT; goto case GAMEPHASE.INIT; case GAMEPHASE.INIT: mScene = new Title(this); mPhase = GAMEPHASE.TITLE; goto case GAMEPHASE.TITLE; case GAMEPHASE.TITLE: if (mScene != null) { result = mScene.move(); if (result == SCENERESULT.DEFAULT) { break; } if (result == SCENERESULT.PROCEED) { mPhase = GAMEPHASE.GAME; mScene = new Stage(this); goto case GAMEPHASE.GAME; } } break; case GAMEPHASE.GAME: if (mScene != null) { result = mScene.move(); if (result == SCENERESULT.DEFAULT) { break; } mPhase = GAMEPHASE.CLEAR; mScene = new Clear(this); goto case GAMEPHASE.CLEAR; } break; case GAMEPHASE.CLEAR: if (mScene != null) { result = mScene.move(); if (result == SCENERESULT.DEFAULT) { break; } mScene = new GameOver(this); mPhase = GAMEPHASE.GAMEOVER; goto case GAMEPHASE.GAMEOVER; } break; case GAMEPHASE.GAMEOVER: if (mScene != null) { result = mScene.move(); if (result == SCENERESULT.DEFAULT) { break; } goto case GAMEPHASE.INIT; } break; default: break; } return(true); }
public Selector(MainWindow app) { mPhase = GAMEPHASE.RESET; mApp = app; mScene = null; }