Esempio n. 1
0
 void Start()
 {
     m_chessPos         = new Vector2[x_len, y_len];
     m_chessPos_P1_next = new Vector2[x_len_chessboard_next, y_len_chessboard_next];
     m_chessPos_P2_next = new Vector2[x_len_chessboard_next, y_len_chessboard_next];
     m_chessState       = new int[x_len, y_len];
     m_chessState_next  = new int[x_len_chessboard_next, y_len_chessboard_next];
     m_chessTurn        = Game_Turn.turn_P1;
     m_playerScore      = new int[2];
     m_playerScore[(int)Game_Turn.turn_P1] = 0;
     m_playerScore[(int)Game_Turn.turn_P2] = 0;
 }
Esempio n. 2
0
    void OnNextTurn()
    {
        //落子成功,更换下棋顺序
        m_chessTurn = (m_chessTurn == Game_Turn.turn_P1) ? Game_Turn.turn_P2 : Game_Turn.turn_P1;

        m_nextChess = new ColoredChess();
        m_nextChess.NewRandomChess(new Vector2Int(0, 0));

        for (int x = 0; x < x_len_chessboard_next; x++)
        {
            for (int y = 0; y < y_len_chessboard_next; y++)
            {
                m_chessState_next[x, y] = 0;
            }
        }
        PlacedChess(new Vector2Int(1, 1), ref m_nextChess, ref m_chessState_next);
    }
Esempio n. 3
0
 void Input_Restart()
 {
     //按下空格重新开始游戏
     if (Input.GetKeyDown(KeyCode.Space))
     {
         for (int i = 0; i < x_len; i++)
         {
             for (int j = 0; j < y_len; j++)
             {
                 m_chessState[i, j] = 0;
             }
         }
         m_isStart   = false;
         m_isPlaying = true;
         m_chessTurn = Game_Turn.turn_P1;
         m_winner    = 0;
     }
 }