/// <summary>
    /// 次の手番に移るコルーチンです
    /// </summary>
    /// <returns>The turn coroutine.</returns>
    IEnumerator NextTurnCoroutine()
    {
        if (field.CountStone(Game_Field.StoneColor.None) == 0)
        {
            yield return(message.Show("Game FINISHED"));

            StartCoroutine(GameFinishedCoroutine());
        }
        else
        {
            IncrementTurnNumber();
            if (field.CountClickableCells() == 0)
            {
                yield return(message.Show(string.Format("{0} cannot put stone. Turn Skipped", CurrentPlayerStoneColor.ToString())));

                IncrementTurnNumber();
                if (field.CountClickableCells() == 0)
                {
                    yield return(message.Show(string.Format("{0} cannot put stone too. Game Finished", CurrentPlayerStoneColor.ToString())));

                    StartCoroutine(GameFinishedCoroutine());
                }
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 次の手番に移るコルーチンです
    /// </summary>
    /// <returns>The turn coroutine.</returns>
    IEnumerator NextTurnCoroutine()
    {
        if (field.CountStone(Game_Field.StoneColor.None) == 0)
        {
            //マスがすべて埋まったならゲーム終了
            yield return(message.Show("GAME FINISHED"));

            StartCoroutine(GameFinishedCoroutine());
        }
        else
        {
            IncrementTurnNumber();
            if (field.CountClickableCells() == 0)
            {
                //石を置ける場所が無いならパス
                yield return(message.Show(string.Format("{0} cannot put stone. TURN SKIPPED", CurrentPlayerStoneColor.ToString())));

                IncrementTurnNumber();
                if (field.CountClickableCells() == 0)
                {
                    //もう一方も石を置ける場所が無いならゲーム終了
                    yield return(message.Show(string.Format("{0} cannot put stoen too. GAME FINISHED", CurrentPlayerStoneColor.ToString())));

                    StartCoroutine(GameFinishedCoroutine());
                }
            }
        }
    }
Esempio n. 3
0
    /// <summary>
    /// 次の手番に移るコルーチンです
    /// </summary>
    /// <returns>The turn coroutine.</returns>
    IEnumerator NextTurnCoroutine()
    {
        if (field.CountStone(Game_Field.StoneColor.None) == 0)
        {
            // マスが全て埋まったならゲーム終了
            yield return(message.Show("GAME FINISHED"));

            StartCoroutine(GameFinishedCoroutine());
            yield break;
        }
        else
        {
            IncrementTurnNumber();
            if (field.CountPuttableCells() == 0)
            {
                // 石を置ける場所が無いならパス
                yield return(message.Show(string.Format("{0} cannot put stone. TURN SKIPPED", CurrentPlayerStoneColor.ToString())));

                IncrementTurnNumber();
                if (field.CountPuttableCells() == 0)
                {
                    // もう一方も石を置ける場所が無いならゲーム終了
                    yield return(message.Show(string.Format("{0} cannot put stone too. GAME FINISHED", CurrentPlayerStoneColor.ToString())));

                    StartCoroutine(GameFinishedCoroutine());
                    yield break;
                }
            }
        }
        // AIの手番の場合は、1秒待ってから処理を実行
        if (IsAITurn)
        {
            yield return(new WaitForSeconds(1f));

            var resultCell = ais[CurrentPlayerStoneColor].GetNextMove(field);
            OnCellClick(field.cells.First(x => x.X == resultCell.x && x.Y == resultCell.y));
        }
    }