Esempio n. 1
0
        public static void ExplodeCell(GridCell gCell, float delay, bool showPrefab, bool fly, bool hitProtection, Action completeCallBack)
        {
            if (gCell.GetBomb() && !gCell.MatchProtected)
            {
                gCell.ExplodeBomb(delay, true, true, true, false, completeCallBack);
                return;
            }

            if (gCell.Overlay && gCell.Overlay.BlockMatch)
            {
                delayAction(gCell.gameObject, delay, () => { gCell.DirectHitOverlay(null); completeCallBack?.Invoke(); });
                return;
            }

            if (gCell.DynamicBlocker)
            {
                delayAction(gCell.gameObject, delay, () =>
                {
                    gCell.DirectHitBlocker(null);
                    if (gCell.Overlay)
                    {
                        gCell.DirectHitOverlay(null);
                    }
                    completeCallBack?.Invoke();
                });
                return;
            }

            if (gCell.StaticBlocker)
            {
                delayAction(gCell.gameObject, delay, () =>
                {
                    gCell.DirectHitBlocker(null);
                    if (gCell.Overlay)
                    {
                        gCell.DirectHitOverlay(null);
                    }
                    completeCallBack?.Invoke();
                });
                return;
            }

            if (gCell.Match && gCell.IsMatchable)
            {
                gCell.Match.Explode(gCell, showPrefab, fly, hitProtection, hitProtection, delay, completeCallBack);
                return;
            }

            if (gCell.Underlay)
            {
                delayAction(gCell.gameObject, delay, () => { gCell.DirectHitUnderlay(null); completeCallBack?.Invoke(); });
                return;
            }

            completeCallBack?.Invoke();
        }