Exemplo n.º 1
0
    //Removes a single block at a location.
    public void RemoveBlock(int x, int y)
    {
        //Make sure the its within bounds...
        if (x < 0 || y < 0)
        {
            return;
        }
        else if (x > gridWidth || y > gridHeight)
        {
            return;
        }
        //Try and remove the block and emit particles.
        try
        {
            if (blockGrid[x, y] != null)
            {
                blockGrid[x, y].EmitParticles(75, blockGrid[x, y].transform.position);
                DestroyObject(blockGrid[x, y].gameObject);
                blockGrid[x, y] = null;

                gameHandler.GetComponent <HandleScore>().AddToScore(1);
            }
        }
        catch
        {
            Debug.Log("Error upon 'RemoveBlock(" + x + "," + y + ")'");
            return;
        }
    }