コード例 #1
0
        public void PlaceGamePiece(GamePiece gamePiece, int xPos, int yPos)
        {
            if (gamePiece == null)
            {
                Debug.Log("BOARD[PlaceGamePiece]: does not contain a valid game piece");
                return;
            }

            if (boardInitialized)
            {
                gamePiece.transform.position = new Vector3(xPos, yPos + offset, 0);
                gamePiece.transform.rotation = Quaternion.identity;
                gamePiece.transform.DOMove(new Vector3(xPos, yPos, 0), 0.5f);

                boardInitialized = false;
            }
            else
            {
                gamePiece.transform.position = new Vector3(xPos, yPos, 0);
                gamePiece.transform.rotation = Quaternion.identity;
            }

            if (IsValidCoordinate(xPos, yPos))
            {
                gamePiece.SetCoord(xPos, yPos);

                _gamePieceArray[xPos, yPos] = gamePiece;
            }
        }