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;
        }
    }
示例#2
0
    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;
        }
    }
示例#3
0
    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;
        }
    }