コード例 #1
0
 public virtual void land_piece_set()
 {
     GameManager.instance.get_white_moves();
     GameManager.instance.get_black_moves();
     GameManager.instance.check_game_end();
     if (GameManager.instance.black_is_in_check())
     {
         Moves_Box.force_print("Black is in check!");
     }
     if (GameManager.instance.white_is_in_check())
     {
         Moves_Box.force_print("White is in check!");
     }
 }
コード例 #2
0
 public virtual Vector2 move_piece(Vector2 old_pos, Vector2 move_here)
 {
     if (GameManager.occupiedSpots[move_here])
     {
         capture(move_here);
     }
     GameManager.pieceLocation.Remove(old_pos);
     GameManager.occupiedSpots[old_pos] = false;
     GameManager.pieceLocation.Add(move_here, this);
     GameManager.instance.isPlayerTurn = !GameManager.instance.isPlayerTurn;
     GameManager.instance.gameStarted  = true;
     Moves_Box.display_move(this, move_here);
     return(move_here);
 }
コード例 #3
0
 public void check_game_end()
 {
     if ((white_moves.Count == 0 && !white_is_in_check()) || (black_moves.Count == 0 && !black_is_in_check()))
     {
         Moves_Box.force_print("Stalemate!");
         StartCoroutine("quitGame");
     }
     if ((white_moves.Count == 0 && white_is_in_check()) || !pieceLocation.ContainsValue(wking_location))
     {
         Moves_Box.force_print("Black Victory!");
         StartCoroutine("quitGame");
     }
     if ((black_moves.Count == 0 && black_is_in_check()) || !pieceLocation.ContainsValue(bking_location))
     {
         Moves_Box.force_print("White Victory!");
         StartCoroutine("quitGame");
     }
 }