public void DoInteraction(Cell cell)
        {
            Debug.Log($"[{GetType().Name}][DoInteraction] cell: {cell}");

            if (_isInteractionLocked)
            {
                return;
            }

            var interactionResult = TryInteract(cell);

            SetLockInteraction(true);

            switch (interactionResult)
            {
            case CellInteractionResult.None:
                OnNoneResultHandler();
                break;

            case CellInteractionResult.CellMatching:
                OnCellMatchingResultHandler(cell);
                break;

            case CellInteractionResult.BonusApplying:
                OnBonusApplyingHandler(cell);
                break;
            }

            CoroutineActionHelp.DelayedAction(0f, () => SetLockInteraction(false));
        }
        private void ProcessBonusApplying(Cell cell, bool forced = false)
        {
            var additionalTime = 1.0f;
            var bonusApplyTime = _bonusController.GetBonusApplyTime(cell.CellBonus.Type);

            _bonusApplyCounter++;
            Debug.Log($"[{GetType().Name}][ProcessBonusApplying] _bonusApplyCounter: {_bonusApplyCounter}");
            CoroutineActionHelp.DelayedAction(bonusApplyTime * additionalTime, () => SetLockInteraction(false));
            CoroutineActionHelp.DelayedAction(GameConstants.GameData.DELAY_BEFORE_DROP_DOWN, () => Dropdown(true), forced);
        }
        private void OnCellMatchingResultHandler(Cell cell)
        {
            ResetBonusCounter();
            var bonusType = BonusType.HorizontalRocket;

            if (_bonusController.TryGetBonuses(_matchingCellList.Count, out bonusType))
            {
                ProcessBonusesCreation(_matchingCellList, cell, bonusType);
                CoroutineActionHelp.DelayedAction(GameConstants.BonusData.BONUS_CREATION_TIME * 0.5f, null, true);
            }
            CoroutineActionHelp.DelayedAction(0f, () => SetLockInteraction(false));
            CoroutineActionHelp.DelayedAction(GameConstants.GameData.DELAY_BEFORE_DROP_DOWN, () => Dropdown(false), true);
            AudioManager.PlaySoundFx(SoundFxType.BlockPress);
        }
Example #4
0
 private void Awake()
 {
     _instanceInner = this;
 }