public void TakeCareOfCases()
    {
        // on finish turn
        if (gameManager.SumMovements.IsPlayerDidAllSteps())
        {
            gameManager.PassTurn();
        }
        else
        {
            if (gameManager.CantMove()) // can't moves stones at all
            {
                if (gameManager.isAllPlayersCanRemoved(gameManager.BoardGame, GameManger.PlayerTurn))
                {
                    gameManager.ShowMessagePassTurn = true; //reset
                    gameManager.ShowMessagePassTurn = gameManager.NeedPassTurnMsg();

                    if (gameManager.ShowMessagePassTurn)
                    {
                        gameManager.ShowErrorPassTurn("אין ביכולתך להזיז אף אבן ולכן התור עובר ליריב");
                    }
                }
                else
                {
                    print("never happen");
                    gameManager.ShowErrorPassTurn("אין ביכולתך להזיז אבנים לפי הקוביות הנתונות ולכן התור עובר ליריב");
                }
            }
        }
    }
Beispiel #2
0
    /*Normal situation - we dont have trapped stones, update the movement of the stone*/
    public void UpdateMoventDiceNormalSituation()
    {
        // using Math.Abs for not checking if the current player is white or black.
        MovementToDecrease = Math.Abs(OnSelected.SelectedPlayer.indexTriangle - TriangleIndex);

        gameManager.CanMoveStonesOnBoard = true;
        UpdateRolling(MovementToDecrease);

        JumpOnOppositeStone();                                                    // check if the participent jump on oppoise stone on the board

        gameManager.BoardGame[OnSelected.SelectedPlayer.indexTriangle - 1].Pop(); // remove from current stack

        UpdateOnSelectedOptionOnStone();
        UpdatePropertiesAfterMovement();

        if (!gameManager.SumMovements.IsPlayerDidAllSteps())  // if player didn't finish his turn beacuse did all steps.
        {
            if (gameManager.isAllPlayersCanRemoved(gameManager.BoardGame, GameManger.PlayerTurn))
            {
                if (gameManager.CantMove())
                {
                    gameManager.ShowMessagePassTurn = true;                          //reset
                    gameManager.ShowMessagePassTurn = gameManager.NeedPassTurnMsg(); // this function check if there is an optional to take out stones by last stack/ stack according to dices

                    if (gameManager.ShowMessagePassTurn)
                    {
                        gameManager.ShowErrorPassTurn("אין ביכולתך להזיז אף אבן ולכן התור עובר לי");
                    }
                }
                OnSelected.SelectedPlayer.PlayerRemoveStones();
            }
            else
            {
                if (gameManager.CantMove())
                {
                    gameManager.ShowErrorPassTurn("אין ביכולתך להזיז אבנים לפי הקוביות הנתונות ולכן התור עובר ליריב"); // if we can't get stones out & can't move at all - show msg
                }
            }
        }
    }