Exemplo n.º 1
0
        public GameObject GetBlockerParticles(BlockEntity blockEntity)
        {
            Blocker blocker = blockEntity as Blocker;

            if (blocker != null)
            {
                switch (blocker._BlockerType)
                {
                case BlockerType.bubble:
                    return(bubbleParticlesPool.GetObj());
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        private void BlockSetting()
        {
            //Block Object Create.
            GameMgr gameMgr = GameMgr.G;

            blockEntities  = new BlockEntity[width, height];
            blockerEntites = new BlockEntity[width, height];

            blockDef.Clear();

            BlockType blockType;
            Vector2   pos     = Vector2.zero;
            Blocker   blocker = null;

            wSize = 72;
            hSize = 73; //원래 h 사이즈 - 85

            int  gap     = width - height;
            bool isTrash = false;

            for (int x = 0; x < width; ++x)
            {
                pos.x = Point(x, width, wSize);
                for (int y = 0; y < height; ++y)
                {
                    var index = x * (width - gap) + y;
                    var temp  = gameMgr.gamePools.GetBlockEntity(gameMgr.level.blocks[index]);
                    Assert.IsNotNull(temp);
                    if (temp is Booster)
                    {
                        switch ((temp as Booster)._BoosterType)
                        {
                        case BoosterType.arrow:
                            ArrowBomb arrow = temp as ArrowBomb;
                            arrow.UpdateSprite();
                            break;

                        case BoosterType.rainbow:
                            ColorType color   = ((LevelBoosterType)gameMgr.level.blocks[index]).colorType;
                            Rainbow   rainbow = temp as Rainbow;
                            rainbow.UpdateSprite(color);
                            break;
                        }
                    }

                    if (!isTrash && temp is Block && IsCheckTrashType((temp as Block)._BlockType))
                    {
                        isTrash = true;
                    }
                    if (temp is Block && (temp as Block)._BlockType == BlockType.sticky)
                    {
                        ++oldStickyBlockCount;
                    }

                    temp.SetDepth(y + 11);
                    temp.Show();
                    temp.SetData(x, y);
                    blockEntities[x, y] = temp;

                    pos.y = Point(y, height, hSize);
                    blockEntities[x, y]._LocalPosition = pos;

                    if (IsCheckBlockerType(gameMgr.level.blocks[index].blockerType))
                    {
                        blockEntities[x, y].SetIconUIColor(0.3f);

                        //Blocker Object Create
                        var cover = gameMgr.gamePools.GetBlockerEntity(gameMgr.level.blocks[index]);
                        Assert.IsNotNull(cover);
                        blocker = cover as Blocker;

                        if (blocker._BlockerType == BlockerType.radiation)
                        {
                            ++oldRadiationount;
                        }

                        blocker.sprite.alpha = 1;
                        cover.SetDepth(y + 21);
                        cover.Show();
                        cover.SetData(x, y);
                        cover._LocalPosition = blockEntities[x, y]._LocalPosition;
                        blockerEntites[x, y] = cover;
                    }

                    if (blockerEntites[x, y] == null && temp is Block)
                    {   // Start Item Random Pos List
                        blockType = (temp as Block)._BlockType;
                        if (!IsCheckNotBlockType(blockType))
                        {
                            blockDef.Add(new BlockDef(x, y));
                        }
                    }
                }
            }

            if (isTrash)
            {
                for (int x = 0; x < width; ++x)
                {
                    var temp = gameMgr.gamePools.GetTrashBox();
                    if (temp == null)
                    {
                        continue;
                    }

                    pos    = blockEntities[x, 0]._LocalPosition;
                    pos.y -= 70;
                    temp.transform.localPosition = pos;
                    temp.SetActive(true);
                    trashBoxs.Add(temp);
                }
            }
        }