コード例 #1
0
        //駒をプレイヤーのものとして登録
        public void AddMyPieces(PieceKind pieceKind, int absoluteFaceId, int forwardFaceId, bool withAnimation = true)
        {
            //Debug.Log($"addmyp kind: {pieceKind}  faceID: {absoluteFaceId}  playerkind: {playerKind}");

            GameObject piecePrefab    = piecesManager.GetPiecePrefab(pieceKind, playerKind);
            GameObject newPieceObject = Instantiate(piecePrefab, new Vector3(0, 0, 0), Quaternion.identity);
            Pieces     newPiece       = newPieceObject.GetComponent <Pieces>();

            if (withAnimation == false)
            {
                newPiece.NotCreateEffect();
            }

            fieldManager.WriteFieldInfo(PieceNum, absoluteFaceId);
            fieldManager.SetPieceAsChild(absoluteFaceId, newPieceObject);

            newPiece.Init(PieceNum, pieceKind, absoluteFaceId, forwardFaceId);

            newPieceObject.transform.LookAt(fieldManager.GetSurfaceInfoById(forwardFaceId).transform);
            fieldManager.AligmentObject(newPieceObject);

            myPieces.Add(newPiece.GetPieceId(), newPiece);
            PieceNum += 1;
        }