Ejemplo n.º 1
0
    IEnumerator FallTile(NumberTile tile)
    {
        if (tile.IsOnFloor())
        {
            yield break;
        }

        List <NumberTile> aboveTiles = NumberTile.FindActiveTilesInDirection(tile, Direction.up);

        do
        {
            yield return(fallWait);

            tile.MoveTile(Direction.down);
            foreach (NumberTile aboveTile in aboveTiles)
            {
                aboveTile.MoveTile(Direction.down);
            }
        } while (!tile.IsOnFloor());

        // Add tiles to the queue to process later
        fallingTiles.Enqueue(tile);
        foreach (NumberTile aboveTile in aboveTiles)
        {
            fallingTiles.Enqueue(aboveTile);
        }
    }
Ejemplo n.º 2
0
    public void HandlePlayerInput(Direction direction)
    {
        if (!inputEnabled || NumberTile.IsInactiveTile(activeTile))
        {
            return;
        }

        switch (direction)
        {
        case Direction.left:
        case Direction.right:
            activeTile.MoveTile(direction);
            break;

        case Direction.down:
            activeTile.DropToFloor();
            DisableControl();
            break;
        }
    }