コード例 #1
0
        public void OnMouseDown()
        {
            if (Game.Controller.die.rolling || Game.Controller.GetCurrentPlayer() != Owner || Game.Controller.GetCurrentPlayer().IsAI)
            {
                return;
            }

            // allow for a king to delegate one piece to a bishop each turn
            if (GetDivision() == "M" && !GetCommander().Moved&& type != "king")
            {
                Owner.Selected         = this;
                Owner.SelectedDivision = GetDivision();
                Game.Controller.commandDelegation.gameObject.SetActive(true);
            }
            else
            {
                Game.Controller.commandDelegation.gameObject.SetActive(false);
            }

            SpriteRenderer.sortingOrder = 1;
            dragging = true;
            Game.Controller.uiManager.DisableAttack();

            if (Game.Controller.GetCurrentPlayer() == Owner)
            {
                MovementUtil.DestroyMovePlates();
                InitiateMovePlates();
            }
        }
コード例 #2
0
    //Swaps the current turn of the game
    public void IncrementTurnCounter()
    {
        movingPiece = false;
        ModifyEvalBar();

        // player reaches move limit
        if (turnCounter >= _currentPlayer.RemainingMoves)
        {
            // change for current player before switching
            MovementUtil.DestroyMovePlates();
            _currentPlayer.Disable();

            AIMoves        = null;
            _currentPlayer = _currentPlayer == Player1 ? Player2 : Player1;
            turnCounter    = 0;
            totalTurns++;
            uiManager.InsertMoveRecord(totalTurns + ". " + (_currentPlayer.Name == "player1" ? "Player 1" : "Player 2"), true, Color.white);
            Text moveText = _currentPlayer == Player1 ? uiManager.whiteMoves : uiManager.blackMoves;
            moveText.text = "1/" + (_currentPlayer.RemainingMoves + 1);

            //reset all bools used to keep track of squadron selection
            _currentPlayer.Reset();
            commandDelegation.Reset();
            commandDelegation.gameObject.SetActive(false);
        }
        // increment turn counter and set ui
        else
        {
            turnCounter++;
            Text moveText = _currentPlayer == Player1 ? uiManager.whiteMoves : uiManager.blackMoves;
            moveText.text = (turnCounter + 1) + "/" + (_currentPlayer.RemainingMoves + 1);
        }
        RequestAI();
    }