void Update() { switch (gameSequence) { case GameSequence.Invalide: gameSequence = GameSequence.Init; break; case GameSequence.Init: playerCard.SetPlayerDeck(); cpuCard.SetCPUdeck(); gameSequence = GameSequence.Deal; break; case GameSequence.Start: gameSequence = GameSequence.Deal; break; case GameSequence.Deal: playerCard.SetPlayerCard(); cpuCard.SetCPUCard(); Debug.Log(playerCard.playerCard.Number); Debug.Log(cpuCard.cpuCard.Number); gameSequence = GameSequence.PlayerJudge; if (playerJudge.Judge) { gameSequence = GameSequence.Show; } break; case GameSequence.Show: if (playerJudge.High) { if (playerCard.playerCard.Number > cpuCard.cpuCard.Number) { Debug.Log("勝ち"); } else { Debug.Log("負け"); } } playerJudge.Judge = false; gameSequence = GameSequence.Start; break; } }
void Update() { switch (gameSequence) { case GameSequence.Invalide: gameSequence = GameSequence.Init; break; case GameSequence.Init: playerCard.SetPlayerDeck(); cpuCard.SetCPUDeck(); gameSequence = GameSequence.Deal; break; case GameSequence.Start: gameJudge.GameJudgeTextInit(); gameSequence = GameSequence.Deal; break; case GameSequence.Deal: playerCard.SetPlayerCard(); cpuCard.SetCPUCard(); Debug.Log(playerCard.playerCard.Number); Debug.Log(cpuCard.cpuCard.Number); gameSequence = GameSequence.PlayerJudge; break; case GameSequence.PlayerJudge: if (playerJudge.Judge) { gameSequence = GameSequence.Show; } break; case GameSequence.Show: cpuCard.ShowCPUCard(); if (playerJudge.High) { if (playerCard.playerCard.Number > cpuCard.cpuCard.Number) { gameJudge.GameJudgeTextView(true); } else { gameJudge.GameJudgeTextView(false); } } else { if (playerCard.playerCard.Number < cpuCard.cpuCard.Number) { gameJudge.GameJudgeTextView(true); } else { gameJudge.GameJudgeTextView(false); } } waitTime -= Time.deltaTime; if (waitTime < 0f) { playerJudge.Judge = false; if (dealer.GameEnd(playerCard.GetPlayerDeck())) { gameSequence = GameSequence.Result; } else { gameSequence = GameSequence.Start; } gameSequence = GameSequence.Start; waitTime = 3f; } break; } }
void Update() { switch (gameSequence) { case GameSequence.Invalide: gameSequence = GameSequence.Init; break; case GameSequence.Init: // PlayerとCPUにデッキをディールする playerCard.SetPlayerDeck(); cpuCard.SetCPUDeck(); gameSequence = GameSequence.Deal; break; case GameSequence.Start: gameJudge.GameJudgeTextInit(); gameSequence = GameSequence.Deal; break; case GameSequence.Deal: // PlayerとCPUにカードをディールする playerCard.SetPlayerCard(); cpuCard.SetCPUCard(); gameSequence = GameSequence.PlayerJudge; break; case GameSequence.PlayerJudge: // 数を予想してボタンを押したらShowに進む if (playerJudge.Judge) { gameSequence = GameSequence.Show; } break; case GameSequence.Show: // プレイヤーが確認したらStartに戻って次のゲーム cpuCard.ShowCPUCard(); bool isWin = false; if (playerJudge.High) { if (playerCard.playerCard.Number > cpuCard.cpuCard.Number) { isWin = true; } } else { if (playerCard.playerCard.Number < cpuCard.cpuCard.Number) { isWin = true; } } gameJudge.GameJudgeTextView(isWin); waitTime -= Time.deltaTime; if (waitTime < 0f) { playerJudge.Judge = false; if (dealer.GameEnd(playerCard.GetPlayerDeck())) { gameSequence = GameSequence.Result; } else { gameSequence = GameSequence.Start; } scoreViewer.AddScoreViewer(isWin); waitTime = 1f; } break; case GameSequence.Result: bool isResultWin = false; if (scoreViewer.playerScore > scoreViewer.cpuScore) { isResultWin = true; } gameJudge.GameResultTextView(isResultWin); break; } }
void Update() { switch (gameSequece) { case GameSequece.Invalide: gameSequece = GameSequece.Init; break; case GameSequece.Init: playerCard.SetPlayerDeck(); cpuCard.SetCPUDeck(); gameSequece = GameSequece.Deal; break; case GameSequece.Start: gameJudge.GameJudgetextInit(); gameSequece = GameSequece.Deal; break; case GameSequece.Deal: playerCard.SetPlayerCard(); cpuCard.SetCPUCard(); Debug.Log(playerCard.playerCard.Number); Debug.Log(cpuCard.cpuCard.Number); gameSequece = GameSequece.PlayerJudge; break; case GameSequece.PlayerJudge: if (playerJudge.Judge) { gameSequece = GameSequece.show; } break; case GameSequece.show: cpuCard.ShowCPUCard(); bool isWin = false; if (playerJudge.High) { if (playerCard.playerCard.Number > cpuCard.cpuCard.Number) { isWin = true; } } else { if (playerCard.playerCard.Number < cpuCard.cpuCard.Number) { isWin = true; } } gameJudge.GameJudgeTextView(isWin); waitTime -= Time.deltaTime; if (waitTime < 0f) { playerJudge.Judge = false; scoreViewer.AddscoreViewer(isWin); if (dealer.GameEnd(playerCard.GetPlayerDeck())) { gameSequece = GameSequece.Result; } else { gameSequece = GameSequece.Start; } waitTime = 1f; } break; case GameSequece.Result: bool isResultWin = false; if (scoreViewer.playerScore > scoreViewer.cpuScore) { isResultWin = true; } gameJudge.GameResultTextView(isResultWin); gameMain.GoToResult(); break; } }