Exemple #1
0
        public CellBonusLine(SpriteBatch spriteBatch, Grid grid, Point posGrid, CellBonus bonus) : base(spriteBatch)
        {
            CellStateSemaphore.ActiveBonuses++;
            _grid    = grid;
            _posGrid = posGrid;
            Bonus    = bonus;

            if (Bonus == CellBonus.HorizontalLine)
            {
                for (int x = 0; x < posGrid.X; x++)
                {
                    _firstTargets.Push(new Point(x, posGrid.Y));
                }
                for (int x = _grid.X - 1; x > posGrid.X; x--)
                {
                    _secondTargets.Push(new Point(x, posGrid.Y));
                }
            }
            else
            {
                for (int y = 0; y < posGrid.Y; y++)
                {
                    _firstTargets.Push(new Point(posGrid.X, y));
                }
                for (int y = _grid.Y - 1; y > posGrid.Y; y--)
                {
                    _secondTargets.Push(new Point(posGrid.X, y));
                }
            }
        }
Exemple #2
0
        private void CalculateBonusHV(List <List <Cell> > matchLines, CellBonus bonus)
        {
            foreach (var line in matchLines)
            {
                if (line.Count > 3)
                {
                    Cell cell = null;
                    foreach (var v in line)
                    {
                        if (cell != null)
                        {
                            if (v.LastMovedTimestamp < cell.LastMovedTimestamp || v.Bonus != CellBonus.None)
                            {
                                continue;
                            }
                        }
                        cell = v;
                    }

                    if (bonuses.ContainsKey(cell))
                    {
                        continue;
                    }

                    bonuses.Add(cell, line.Count == 4 ? bonus : CellBonus.Bomb);
                }
            }
        }
 public static Texture2D GetTextureBonusTile(CellBonus bonus) => _textureBonus[bonus];