コード例 #1
0
ファイル: BonusController.cs プロジェクト: D3ad5h0t/Match3
 private static void ChangeGemInBlastRadius(FieldCell fieldCell)
 {
     if (fieldCell.Gem != null && (fieldCell.Gem.Type == GemType.Bomb ||
                                   fieldCell.Gem.Type == GemType.HorizontalLine ||
                                   fieldCell.Gem.Type == GemType.VerticalLine))
     {
         fieldCell.Gem.WasMoved = true;
     }
     else
     {
         GemsController.DeleteGem(fieldCell);
     }
 }
コード例 #2
0
ファイル: GameBoardConroller.cs プロジェクト: D3ad5h0t/Match3
        public static FieldCell GenerateNewFieldCell(int column, int row, Random random, EventHandler onClick)
        {
            var cell = new FieldCell
            {
                Id       = (column + 1) + 8 * row,
                Column   = column,
                Row      = row,
                Position = new Vector2(DefaultCell.Width * column, DefaultCell.Height * 2 + DefaultCell.Height * row),
                Texture  = TextureController.GetTexture(BackgroundType.Ground.SpritePath())
            };

            cell.Click += onClick;

            var type = (GemType)random.Next(1, 6);

            cell.Gem = GemsController.GetNewGem(cell.Position, type);

            return(cell);
        }
コード例 #3
0
ファイル: GameBoardConroller.cs プロジェクト: D3ad5h0t/Match3
        private static void SetCoincidenceResults(List <List <FieldCell> > list, DirectionType type)
        {
            foreach (var element in list)
            {
                if (element.Count > 2 && element.Count < 4)
                {
                    GemsController.DeleteGems(element);
                }
                else if (element.Count > 3 && element.Count < 5)
                {
                    var gemType = type == DirectionType.Horizontal ? GemType.HorizontalLine : GemType.VerticalLine;

                    AddNewBonus(element, gemType);
                }
                else if (element.Count > 4)
                {
                    AddNewBonus(element, GemType.Bomb);
                }
            }
        }
コード例 #4
0
ファイル: GameBoardConroller.cs プロジェクト: D3ad5h0t/Match3
        private static void AddNewBonus(List <FieldCell> element, GemType gemType)
        {
            FieldCell bonus = null;

            if (GameState.Move != null && GameState.Move.FirstCell != null && element.Contains(GameState.Move.FirstCell))
            {
                bonus = GameState.Move.FirstCell;
            }

            if (GameState.Move != null && GameState.Move.SecondCell != null && element.Contains(GameState.Move.SecondCell))
            {
                bonus = GameState.Move.SecondCell;
            }

            bonus     = bonus ?? element.Last();
            bonus.Gem = GemsController.GetNewGem(bonus.Position, gemType);

            element.Remove(bonus);

            GemsController.DeleteGems(element);
        }