public void Add(BlockObject blockObject)
 {
     int posX = blockObject.posX;
     List<BlockObject> activeList = activeGroup [posX];
     activeList.Add(blockObject);
     activeColumnCount [posX]++;
     this.CalculateMinMax (activeValues,activeColumnCount);
     this.CalculateMinMax (allValues,activeColumnCount,restColumnCount);
     blockObject.block.GetComponent<BlockData>().blockObject=blockObject;
 }
 private void CreateTresure(BlockObject blockObject)
 {
     //losujemy czy dany blok ma skarb
     Transform tresure=(Transform)GameObject.Instantiate(tresureSpawn.transform,new Vector3(blockObject.block.transform.position.x+0.1f,blockObject.block.transform.position.y+1.3f,blockObject.block.transform.position.z),tresureSpawn.transform.rotation);
     tresure.GetComponent<TresureController> ().SetType ((int)Random.Range(0,6));
     tresure.parent = blockObject.block;
     blockObject.tresure = tresure;
 }
 private void CreateCrab(BlockObject blockObject)
 {
     //losujemy czy dany blok ma skarb
     Transform crab=(Transform)GameObject.Instantiate(crabSpawn.transform,new Vector3(blockObject.block.transform.position.x,blockObject.block.transform.position.y+0.9f,blockObject.block.transform.position.z),crabSpawn.transform.rotation);
     //crab.GetComponent<LandEnemyController> ().SetType ((int)Random.Range(0,6));
     crab.parent = blockObject.block;
     blockObject.enemy = crab;
     enemyList.Add (crab);
 }
 private void CreateSpikes(BlockObject blockObject)
 {
     Transform spikes=(Transform)GameObject.Instantiate(spikesSpawn.transform,new Vector3(blockObject.block.transform.position.x,blockObject.block.transform.position.y+0.57f,blockObject.block.transform.position.z),spikesSpawn.transform.rotation);
     spikes.parent = blockObject.block;
     blockObject.spikes = spikes;
 }
        private void CreateBlock(int level)
        {
            if(blockSpawn!=null){
                int posNum=RandBlockPosition();
                Transform block;
                if(this.isEvenColumn==true){//parzyste
                    if(posNum<0){
                        block=(Transform)Instantiate(blockSpawn.transform,new Vector3(blockWidth*(posNum+0.5f),(blockHeight*blockGroup.GetRestMaxVal()+level)*blockHeight+offsetY,0),blockSpawn.transform.rotation);
                    }else{
                        block=(Transform)Instantiate(blockSpawn.transform,new Vector3(blockWidth*(posNum-0.5f),(blockHeight*blockGroup.GetRestMaxVal()+level)*blockHeight+offsetY,0),blockSpawn.transform.rotation);
                    }
                }else{//pazyste
                    block=(Transform)Instantiate(blockSpawn.transform,new Vector3(blockWidth*posNum,(blockHeight*blockGroup.GetRestMaxVal()+level)*blockHeight+offsetY,0),blockSpawn.transform.rotation);
                }
                BlockObject blockObject=new BlockObject(block,blockWidth,blockHeight);
                int posRow=blockGroup.GetRestColumnCount(posNum)+blockGroup.GetActiveColumnCount(posNum);
                blockObject.SetPosition(posNum,posRow);

                blockGroup.Add(blockObject);

                int randEvent=(int)Random.Range(0,100);
            //	Debug.Log("randEvent "+randEvent+"  newLinesRows "+newLinesRows);
                if(randEvent>70&&newLinesRows>3){
                    if(randEvent>95&&newLinesRows>30){
                        this.CreateSpikes(blockObject);
                    }else if(randEvent>70){//kolce mogą pojawić się tylko jak mamy więcej niż 10 wierszy i wylosujemy 80-90
                        CreateCrab(blockObject);
                    }
                }else if(randEvent>=0){
                    this.CreateTresure(blockObject);
                }
                blockObject.SetOrder(posRow*2+(posNum+10)*10);
            }
        }