예제 #1
0
    public Create1v1(Vector3 _offset, VisualPlayer _player1, VisualPlayer _player2)
    {
        board = new DrawBoardGame();
        board.Initialize(8, 10);
        board.DrawBoard(_offset);

        board_offset = _offset;

        p1        = _player1;
        p1_offset = new Vector3(-1, -2, 0) + board_offset;
        p1.slist  = board.DrawStash(p1_offset);

        p2        = _player2;
        p2_offset = new Vector3(-1, 9, 0) + board_offset;
        p2.slist  = board.DrawStash(p2_offset);

        p1.AddPieceStash(new Mage());
        p1.AddPieceStash(new BoardPiece());
        p1.AddPieceStash(new BoardPiece());
        p1.AddPieceStash(new BoardPiece());
        p1.AddPieceStash(new BoardPiece());

        p2.AddPieceStash(new BoardPiece());
        p2.AddPieceStash(new BoardPiece());
        p2.AddPieceStash(new BoardPiece());
        p2.AddPieceStash(new BoardPiece());
        p2.AddPieceStash(new BoardPiece());
        p2.AddPieceStash(new Dummy());

        turn = p1;
    }
예제 #2
0
 //TODO: Can cause concurrency problems if 2 players remove at same time
 public void GivePieceToPlayer(VisualPlayer _player)
 {
     if (shop_pieces.Count > 0)
     {
         int id = Random.Range(0, shop_pieces.Count);
         _player.AddPieceStash(shop_pieces[id]);
         shop_pieces.RemoveAt(id);
     }
 }