示例#1
0
    public void Select(Location location)
    {
        if (selectingOrMoving == Selecting)
        {
            from = location;

            ActivateToSpaces();
        }
        else
        {
            to = location;

            CurrentPlayer = !CurrentPlayer;

            MakeMove();
            SyncWithGame();
            Debug.Log(computerPlayerBool);
            //over is borken it;s not even firing
            if (game.Over() || game.Choices().Count == 0)
            {
                Debug.Log("winner!");
                Debug.Log("hooman won");
                SyncWithGame();
                return;
            }
            else if (computerPlaying && CurrentPlayer == computerPlayerBool)
            {
                Move computerMove = game.PickOneForMe();

                to            = computerMove.to;
                from          = computerMove.from;
                CurrentPlayer = !CurrentPlayer;

                MakeMove();
                if (game.Choices().Count == 0)
                {
                    Debug.Log("winner!");
                    Debug.Log("computer won");
                    SyncWithGame();
                    return;
                }
                SyncWithGame();
            }
        }
        selectingOrMoving = !selectingOrMoving;
    }