Exemplo n.º 1
0
    public virtual void Break(float animDelay, float animOffset = 0f, int multiplier = 1)
    {
        if (_active)
        {
            SetActive(false);
            State = BlockState.BREAKING;

            LeanTween.delayedCall(gameObject, animDelay, () =>
            {
                GameEventManager.TriggerEvent(GameEventType.BREAK_BLOCK, this);
                customBreakEffect();

                MyBoard.ApplyComboMultiplierFromMatch(multiplier, this);
                MyTile.RemoveBoardObject(TileLayer);

                if (State == BlockState.BREAKING)
                {
                    LeanTween.scale(gameObject, Vector3.zero, 0.075f).setOnComplete(() =>
                    {
                        Destroy(gameObject);
                    }).setDelay(animOffset);
                }
            });
        }
    }