Exemplo n.º 1
0
    private void EndPromotion(GameObject become)  //promotion收尾工作
    //模型复制标签网格Collider 销毁 PushPop camera归位
    {
        ChangeAppearance(pawn, become, become.tag);
        ChessPromoteInfo chessPromoteInfo = new ChessPromoteInfo(isWhite, pawn, startPosition, startPosition, "Pawn", become.tag);

        ChessPieceMoveManager.chessPieceMoveManager.SendMessage("PushChessMoveInfo", chessPromoteInfo);
        ChessPieceMoveManager.chessPieceMoveManager.SendMessage("AfterMoveCheck", !isWhite);
        StartCoroutine(LerpToPosition(Camera.main.gameObject, cameraStartPosition, cameraStartRotation, 2));
        if (ChessManager.AIMode == true)
        {
            Invoke("ExecuteAIShowTime", 0.8f);//玩家操作完再切换到AIPlay ,0.8秒是摄像机移动的时间
        }
    }
Exemplo n.º 2
0
 private void ChangePosition(Vector3 position)
 {
     if (UNITYBUGBUGBUGAI == false)
     {
         //print(gameObject.name + " MoveFrom " + Position + " To " + position);
         ChessPieceMoveManager.chessPieceMoveManager.chessPiecesOnChessboardDictionary.Remove(Position);
     }
     Position = position;
     SetTargetPosition(ChessPieceMoveManager.chessPieceMoveManager.chessboardDictionary[position].transform.position); //通过坐标确定世界位置
     ChessPieceMoveManager.chessPieceMoveManager.chessPiecesOnChessboardDictionary.Add(position, gameObject);          //棋子位置字典
     if (gameObject.tag == "Pawn")                                                                                     //也要case tag 比如pawn行至底线 变身!(升格)
     {
         int maxIndex = ChessboardManager.Level - (int)Mathf.Abs(position.z);
         // print("MAxIndex: " + maxIndex);
         if (ChessManager.AIPlaying == false)  //玩家的操作
         {
             if (isWhite)
             {
                 if (position.y == maxIndex)
                 {
                     UIManager.UIM.SendMessage("LabelPromote");
                     PawnPromoteManager.PPM.SendMessage("StartPromotion", gameObject);
                 }
             }
             else
             {
                 if (position.y == 1)
                 {
                     UIManager.UIM.SendMessage("LabelPromote");
                     PawnPromoteManager.PPM.SendMessage("StartPromotion", gameObject);
                 }
             }
         }
         else                                   //AI的操作
         {
             if (ChessManager.CM.isWhitePlayer) //player是白色 AI为黑色 终点是零
             {
                 if (position.y == 1)
                 {
                     queenModel = GameObject.Find("QueenModel");
                     //print("Find QueenModel: " + queenModel);
                     UIManager.UIM.SendMessage("LabelPromote");
                     PawnPromoteManager.ChangeAppearance(gameObject, queenModel, "Queen");
                     ChessPromoteInfo chessPromoteInfo = new ChessPromoteInfo(isWhite, gameObject, position, position, "Pawn", "Queen");
                     ChessPieceMoveManager.chessPieceMoveManager.SendMessage("PushChessMoveInfo", chessPromoteInfo);
                     //不用Check 之后在AIShowTIme会Check
                     queenModel = null;
                 }
             }
             else
             {
                 if (position.y == maxIndex)
                 {
                     queenModel = GameObject.Find("QueenModel");
                     //print("Find QueenModel: " + queenModel);
                     UIManager.UIM.SendMessage("LabelPromote");
                     PawnPromoteManager.ChangeAppearance(gameObject, queenModel, "Queen");
                     ChessPromoteInfo chessPromoteInfo = new ChessPromoteInfo(isWhite, gameObject, position, position, "Pawn", "Queen");
                     ChessPieceMoveManager.chessPieceMoveManager.SendMessage("PushChessMoveInfo", chessPromoteInfo);
                     queenModel = null;
                 }
             }
         }
     }
 }