コード例 #1
0
ファイル: LevelFileIO.cs プロジェクト: PeachTreeOath/LD39
    private BoardPiece createWaifu(int rowNum, int colCount, List <int> prams)
    {
        //TODO params
        GameObject      bGo = Instantiate(ResourceLoader.instance.waifuPieceFab);
        WaifuBoardPiece pc  = bGo.GetComponent <WaifuBoardPiece>();

        pc.SetBoard(curBoard);
        curBoard.AddPiece(pc, colCount, rowNum);
        return(pc);
    }
コード例 #2
0
ファイル: LevelLoader.cs プロジェクト: PeachTreeOath/LD39
    /// <summary>
    /// Populate a board with content...somehow
    /// </summary>
    /// <param name="board">The board that will have content loaded into it</param>
    /// Params for generation:
    /// <param name="btype">Type of board</param>
    /// <param name="level">Level being loaded</param>
    public void LoadBoardContent(Board board, BoardManager.BoardType btype, int level)
    {
        if (board == null)
        {
            Debug.LogError("Invalid board state");
            return;
        }

        //This is test code only
        if (btype == BoardManager.BoardType.RELATIONSHIP)
        {
            for (int y = 0; y < board.GetBoardSize(); y++)
            {
                GameObject        bpOil = Instantiate(ResourceLoader.instance.barrierPieceFab);
                BarrierBoardPiece bp    = bpOil.GetComponent <BarrierBoardPiece>();
                bp.SetBoard(board);
                //vertical barrier at x=2
                board.AddPiece(bp, 2, y);
            }

            GameObject      waifu = Instantiate(ResourceLoader.instance.waifuPieceFab);
            WaifuBoardPiece wbp   = waifu.GetComponent <WaifuBoardPiece>();
            wbp.SetBoard(board);
            //vertical barrier at x=2
            board.AddPiece(wbp, 8, 8);

            //addKey(board, 0, 3, 3);
            //addKey(board, 1, 4, 5);
            //addKey(board, 2, 5, 8);
        }
        if (btype == BoardManager.BoardType.HEALTH)
        {
            //health pots wherever
            for (int x = 0; x < 10; x += 3)
            {
                for (int y = x; y < 8; y += 2)
                {
                    GameObject       horse = Instantiate(ResourceLoader.instance.potionPieceFab);
                    PotionBoardPiece bigH  = horse.GetComponent <PotionBoardPiece>();
                    bigH.SetBoard(board);
                    board.AddPiece(bigH, x, y);
                    addZoneBarrier(board, 0, 0, 1);
                    addZoneBarrier(board, 1, 1, 2);
                }
            }
        }
        if (btype == BoardManager.BoardType.EDUCATION)
        {
            for (int x = 6; x <= 8; x++)
            {
                for (int y = 2; y < board.GetBoardSize() - 2; y++)
                {
                    GameObject        mlady = Instantiate(ResourceLoader.instance.eduBookFab);
                    EduBookBoardPiece ml    = mlady.GetComponent <EduBookBoardPiece>();
                    ml.SetBoard(board);
                    //vertical barrier at x=6,7
                    board.AddPiece(ml, x, y);
                    addZoneBarrier(board, 2, 0, 2);
                }
            }
        }
    }