コード例 #1
0
        public void ExecuteBooster(KulaySlot boosterSlot, List <KulaySlot> boardSlots, int boardSideCount)
        {
            _currentSlots          = boardSlots;
            _currentBoardSideCount = boardSideCount;
            var boostType = boosterSlot.Booster;

            if (boostType == BoosterType.BurstAll)
            {
                ExecuteBoosterEffect(boosterSlot.SlotIndex, boostType, boardSlots, boardSideCount);
                boosterSlot.Pop();
                return;
            }

            var adjacentBoosterSlots = GetAdjacentBoosterSlots(boosterSlot);

            if (adjacentBoosterSlots.Count > 0)
            {
                var adjacentBoosterTypes = from slot in adjacentBoosterSlots where slot.IsBoostSlot select slot.Booster;
                boosterSlot.SetBooster(CombineBooster(boostType, adjacentBoosterTypes.ToList()));

                foreach (var adjacentSlot in adjacentBoosterSlots)
                {
                    adjacentSlot.Pop();
                }
            }
            else
            {
                ExecuteBoosterEffect(boosterSlot.SlotIndex, boostType, boardSlots, boardSideCount);
                boosterSlot.Pop();
            }
        }
コード例 #2
0
        private List <KulaySlot> GetAdjacentBoosterSlots(KulaySlot boosterSlot)
        {
            var adjacentIndexes = boosterSlot.SlotIndex.GetAdjacentIndex(_currentBoardSideCount);
            var adjacentSlots   = new List <KulaySlot>(_currentSlots.FindAll(slot => adjacentIndexes.Contains(slot.SlotIndex)));

            return(new List <KulaySlot>(adjacentSlots.FindAll(slot => slot.IsBoostSlot && slot.Booster != BoosterType.BurstAll)));
        }