Exemplo n.º 1
0
    public void saveBrick(Brick bks)
    {
        BrickSave bSv = bricks[bks.id];

        bSv.drilledAmount = bks.drilledAmount;
        bSv.mineralType   = bks.mineralType;
        bSv.neighbourCode = bks.neighbourCode;
    }
Exemplo n.º 2
0
    static PlayerSave initFirstPlay()
    {
        PlayerSave s = new PlayerSave();
        BrickSave  brick;
        int        ROW    = 161;
        int        COLUMN = 50;
        int        brkType;
        float      rand;

        for (int i = 0; i < ROW; i++)
        {
            for (int j = 0; j < COLUMN; j++)
            {
                brick               = new BrickSave();
                brick.id            = i * COLUMN + j;
                brkType             = getBrickType(i);
                brick.brickType     = (BrickType)brkType;
                brick.drilledAmount = 0;
                brick.neighbourCode = i * COLUMN + j < COLUMN ? "1011":"1111";
                //add minerals
                if (i == ROW - 1 || (i == 0 && j >= 22 && j <= 27))
                {
                    //last row, cant be drilled
                    brick.mineralType = MineralType.NonBreakableStone;
                }
                else
                {
                    rand = UnityEngine.Random.value;
                    if (rand < 0.2f)
                    {
                        brick.mineralType = (MineralType)(rand > 0.18? brkType + 1: (rand > 0.13? (int)MineralType.Stone:brkType));
                    }
                }
                s.bricks.Add(brick);
            }
        }
        //first commit
        s.commit();

        return(s);
    }
Exemplo n.º 3
0
    static PlayerSave initFirstPlay()
    {
        PlayerSave s = new PlayerSave();
        BrickSave brick;
        int ROW = 161;
        int COLUMN = 50;
        int brkType;
        float rand;
        for (int i=0; i<ROW; i++) {
            for(int j=0; j<COLUMN; j++){
                brick = new BrickSave();
                brick.id = i*COLUMN+j;
                brkType = getBrickType(i);
                brick.brickType = (BrickType)brkType;
                brick.drilledAmount = 0;
                brick.neighbourCode = i*COLUMN+j<COLUMN ? "1011":"1111";
                //add minerals
                if(i==ROW-1 || (i == 0 && j >= 22 && j <= 27)){
                    //last row, cant be drilled
                    brick.mineralType = MineralType.NonBreakableStone;
                }else{
                    rand = UnityEngine.Random.value;
                    if(rand <0.2f){
                        brick.mineralType = (MineralType)(rand>0.18? brkType+1: (rand> 0.13? (int)MineralType.Stone:brkType));
                    }
                }
                s.bricks.Add(brick);
            }
        }
        //first commit
        s.commit ();

        return s;
    }