Beispiel #1
0
    System.Collections.IEnumerator BonusDeletingProcess(int delCount)
    {
        var delBlockList = _itemList
                           .Where(block => block.gameObject.activeSelf)
                           .Where(block => block.hitCounter > 0)
                           .Where(block => block as BossController == null) //боссов бустером не уничтожаем
                           .OrderBy(block => block.level * 1000 + block.hitCounter)
                           .Take(delCount);

        game.player.effectController.PlayLightningReadyEffect();
        yield return(new WaitForSeconds(0.6f));

        foreach (var item in delBlockList)
        {
            CubeController cController = item.GetComponent <CubeController>();
            game.OnDamageDealtUpdateLevelProgress(item.hitCounter);
            if (cController != null)
            {
                cController.OnInstantDeleting();
            }
        }

        //если на карте больше не осталось блоков - сдвигаем вниз и генерим новые (конец уровня)
        if (BlockHitCounter == 0)
        {
            if (!game.Machine.IsTutorial)
            {
                if (game.Machine.IsCampaign)
                {
                    ((CampaignMissionState)game.Machine.ActiveState).StartNextLine();
                }
                else
                {
                    game.OnEndTurn();
                    game.Machine.ForceNextState <ShiftState>();
                }
            }
            else
            {
                game.Machine.ActiveState.OnPlayerUsedBooster();
            }
        }
        game.CheckBlocksNearPlayer();
        actionOnBoosterProcessEnded?.Invoke();
        yield break;
    }