Beispiel #1
0
    private BoardPiece createZoneBarrier(int rowNum, int colCount, int colorType)
    {
        GameObject            bGo = Instantiate(ResourceLoader.instance.zoneBarrierPieceFab);
        ZoneBarrierBoardPiece pc  = bGo.GetComponent <ZoneBarrierBoardPiece>();

        pc.SetBoard(curBoard);
        pc.setKey(colorType);
        curBoard.AddPiece(pc, colCount, rowNum);
        return(pc);
    }
Beispiel #2
0
    //Make a square. temp code only
    private void addZoneBarrier(Board board, int zoneKey, int start, int end)
    {
        List <Vector2> squares = new List <Vector2>();

        //top row
        for (int y = start; y < end; y++)
        {
            for (int x = start; x < board.GetBoardSize() - start; x++)
            {
                Vector2 va = new Vector2(x, y);
                if (!squares.Contains(va))
                {
                    squares.Add(va);
                }
                Vector2 vb = new Vector2(y, x);
                if (!squares.Contains(vb))
                {
                    squares.Add(vb);
                }
            }
        }
        //bot row
        for (int y = board.GetBoardSize() - end; y < board.GetBoardSize() - start; y++)
        {
            for (int x = start; x < board.GetBoardSize() - start; x++)
            {
                Vector2 va = new Vector2(x, y);
                if (!squares.Contains(va))
                {
                    squares.Add(va);
                }
                Vector2 vb = new Vector2(y, x);
                if (!squares.Contains(vb))
                {
                    squares.Add(vb);
                }
            }
        }


        foreach (Vector2 v in squares)
        {
            GameObject            vgg = Instantiate(ResourceLoader.instance.zoneBarrierPieceFab);
            ZoneBarrierBoardPiece vvv = vgg.GetComponent <ZoneBarrierBoardPiece>();
            vvv.SetBoard(board);
            vvv.setKey(zoneKey);
            board.AddPiece(vvv, (int)v.x, (int)v.y);
        }
    }