Esempio n. 1
0
 private void OnDestroy()
 {
     if (OnBlockDestroyed != null)
     {
         OnBlockDestroyed.Invoke(this.gameObject);
     }
 }
Esempio n. 2
0
File: Level.cs Progetto: damrem/ld48
    void DestroyBlock(Cell cell, bool animate = true)
    {
        var block = GetBlock(cell);

        if (!block)
        {
            return;
        }
        if (block.IsUnbreakable)
        {
            return;
        }

        Blocks[cell.X, cell.Y] = null;

        void onEnd(Block block)
        {
            Destroy(block.gameObject);
            OnBlockDestroyed?.Invoke();
        };
        if (animate)
        {
            block.AnimateDestroy(onEnd);
        }
        else
        {
            onEnd(block);
        }
    }
Esempio n. 3
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (Stage == blocksByStages.Length - 1)
     {
         levelManager.BlockDestroyed();
         gameObject.SetActive(false);
         OnBlockDestroyed?.Invoke(gameObject, score.Score);
         return;
     }
     blocksByStages[Stage].SetActive(false);
     Stage++;
     blocksByStages[Stage].SetActive(true);
 }
Esempio n. 4
0
        private void OnCollisionEnter2D(Collision2D other)
        {
            Bomb b = other.gameObject.GetComponent <Bomb>();

            if (b == null)
            {
                return;
            }
            if (!this._wall.IsDestroyedByColor(b.CurrentColor))
            {
                return;
            }
            OnBlockDestroyed?.Invoke(this, null);
            Destroy(this.gameObject);
        }