Пример #1
0
        public override CellsGroup GetArea(GridCell gCell)
        {
            CellsGroup cG = new CellsGroup();

            //  Debug.Log(gCell);
            if (!gCell)
            {
                return(cG);
            }
            switch (OData.bombType)
            {
            case BombDir.Vertical:
                cG.AddRange(gCell.GColumn.cells);      //cG.AddRange(gCell.GColumn.GetDynamicArea());
                break;

            case BombDir.Horizontal:
                cG.AddRange(gCell.GRow.cells);     // cG.AddRange(gCell.GRow.GetDynamicArea());
                break;

            case BombDir.Radial:
                List <GridCell> areaRad = MBoard.grid.GetAroundArea(gCell, 1).Cells;
                cG.Add(gCell);
                foreach (var item in areaRad)
                {
                    cG.Add(item);        // if (item.IsMatchable)
                }
                break;

            case BombDir.Color:
                cG.AddRange(MGrid.GetAllByID(OData.matchID).SortByDistanceTo(gCell));
                break;
            }
            return(cG);
        }
Пример #2
0
        public override CellsGroup GetArea(GridCell gCell)
        {
            CellsGroup cG = new CellsGroup();

            cG.AddRange(gCell.GColumn.cells);
            return(cG);
        }
Пример #3
0
        public override CellsGroup GetArea(GridCell gCell)
        {
            CellsGroup cG = new CellsGroup();

            if (!gCell)
            {
                return(cG);
            }

            cG.AddRange(MGrid.GetAllByID(OData.matchID).SortByDistanceTo(gCell));
            return(cG);
        }
Пример #4
0
        public CellsGroup GetAroundArea(GridCell gCell, int radius)
        {
            radius = Mathf.Max(0, radius);
            CellsGroup res = new CellsGroup();

            if (radius > 0)
            {
                for (int i = 1; i <= radius; i++)
                {
                    res.AddRange(GetWave(gCell, i).Cells);
                }
            }
            return(res);
        }
Пример #5
0
        /// <summary>
        /// Return all closed not intersected areas
        /// </summary>
        /// <returns></returns>
        public List <GridCell> GetDetacheCells()
        {
            CellsGroup main  = new CellsGroup(); // main group from 0 row
            CellsGroup neigh = new CellsGroup();
            CellsGroup neighTemp;

            main.AddRange(Rows[serviceRowsCount].GetNotEmptyCells()); // start at service rows
            NeighBors nCells;

            for (int i = 0; i < main.Length; i++)
            {
                nCells = new NeighBors(main.cells[i]);
                neigh.AddRange(nCells.NotEmptyCells);// neigh.AddRange(main.cells[i].NotEmptyNeighBornCells());
            }

            while (neigh.Length > 0) // find and add to group not empty neighborns
            {
                main.AddRange(neigh.cells);
                neighTemp = new CellsGroup();
                foreach (var item in neigh.cells)
                {
                    nCells = new NeighBors(item);
                    neighTemp.AddRange(nCells.NotEmptyCells);
                }
                neigh = neighTemp;
                neigh.Remove(main.cells);
            }

            CellsGroup all = new CellsGroup();

            all.AddRange(GetNotEmptyCells());

            all.Remove(main.cells);
            // Debug.Log("detouched: " + all.ToString());
            return(all.cells);
        }
Пример #6
0
        private void Shooting()
        {
            // BubblesShooter.Instance.ShowSwapPath();

            if (TouchManager.IsTouched && BubblesShooter.Instance.TouchInRange())
            {
                BubblesShooter.Instance.ShowShootLine();
            }
            else if (TouchManager.IsTouched && !BubblesShooter.Instance.TouchInRange())
            {
                BubblesShooter.Instance.HideShootLine();
                BubblesShooter.Instance.CleanTargets();
            }
            else if (!TouchManager.IsTouched)
            {
                BubblesShooter.Instance.HideShootLine(); //Debug.Log("Can Shoot " + BubblesShooter.CanShoot);

                if (BubblesShooter.CanShoot)             // shoot
                {
                    GoToDTMode();                        // diasable touch
                    mainSeq = new TweenSeq();
                    mainSeq.Add((callBack) =>            // move bubble to free target, hit target, and check result
                    {
                        BubblesShooter.Instance.Shoot(callBack);
                    });

                    mainSeq.Add((callBack) => // collect all bubbles in shootarea
                    {
                        BubblesShooter.Instance.ShootCollect(callBack);
                    });

                    mainSeq.Add((callBack) => //  collect all fall down objects
                    {
                        BubblesShooter.Instance.CleanTargets();
                        detCells = new CellsGroup();
                        detCells.AddRange(grid.GetDetacheCells());
                        detCells.FallDownCollect(BubblesShooter.Instance.BubbleScore, null);
                        WController.CheckResult(false, false);// check shoot result
                        grid.AddEmptyRow();

                        callBack();
                    });

                    if (WController.GameLevelType == LevelType.AnchorLevel) // update anchor path
                    {
                        mainSeq.Add((callBack) =>
                        {
                            if (anchor && anchor.gameObject.activeSelf)
                            {
                                anchor.UpdatePath();
                            }
                            WController.CheckResult(false, false);// check shoot result
                            callBack();
                        });
                    }

                    mainSeq.Add((callBack) =>
                    {
                        grid.MoveToVisible(() =>
                        {
                            if (WController.GameResult == GameResult.Win)
                            {
                                detCells = new CellsGroup();
                                detCells.AddRange(grid.GetNotEmptyCells());
                                detCells.FallDownCollect(BubblesShooter.Instance.BubbleScore, null);
                            }
                            WController.CheckResult(false, false);// check shoot result after falldown
                            GoToShootMode();
                            callBack();
                        });
                    });

                    mainSeq.Start();
                }
            }
        }