//駒をrotate辺回転する ex)rotateが-1で10角形なら-36度 public void RotatePiece(int pieceId, int rotate) { Pieces piece = GetPieceById(pieceId); int rotationAmount = (360 / piece.GetShape()) * rotate; Quaternion rot = Quaternion.AngleAxis(rotationAmount, Vector3.up); Quaternion q = piece.transform.rotation; piece.transform.rotation = q * rot; int forwardFaceId = fieldManager.ConvertRelative2AbsId(piece.GetFaceId(), 0, piece.GetForwardDirection()); piece.SetForwardFaceId(forwardFaceId); }
// return circle faceId private List <int> circleFaceIdCheck(FieldManager field, Pieces piece) { //何角形のますにいるかをint型で返す int faceShape = piece.GetShape(); List <int> circleFaceIdCheck = new List <int>(); //辞書型配列で受け取る Dictionary <int, List <int> > MovableRange = GameManager.ManagerStore.piecesManager.GetMoveRange(piece.GetKind()); //辞書型配列で受け取った稼働範囲からforeachでそれぞれ検証 List <int> movableFaces = MovableRange[faceShape]; foreach (int movableFace in movableFaces) { //候補の面の相対idを絶対idに変換 circleFaceIdCheck.Add(field.ConvertRelative2AbsId(piece.GetFaceId(), movableFace, piece.GetForwardDirection())); } return(circleFaceIdCheck); }
public static List <int> GetVisibleFaces(this Pieces pieces) { if (pieces.GetKind() == PieceKind.King) { if (pieces.GetShape() == 4) { return(new List <int> { 0, 1, 2, 3 }); } else if (pieces.GetShape() == 6) { return(new List <int> { 0, 1, 2, 3, 4, 5 }); } else { return(new List <int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }); } } else if (pieces.GetKind() == PieceKind.Pawn) { if (pieces.GetShape() == 4) { return(new List <int> { 0, 1, 3 }); } else if (pieces.GetShape() == 6) { return(new List <int> { 0, 1, 5 }); } else { return(new List <int> { 0, 1, 9 }); } } else if (pieces.GetKind() == PieceKind.Queen) { if (pieces.GetShape() == 4) { return(new List <int> { 0, 1, 3, 4 }); } else if (pieces.GetShape() == 6) { return(new List <int> { 0, 1, 5, 6 }); } else { return(new List <int> { 0, 1, 9, 10 }); } } return(new List <int>()); }