Exemple #1
0
    /// <summary>
    /// default moving for current TileObject
    /// </summary>
    void DefaultMoveDown()
    {
        if (!fieldManager.MoveTiles(currentTileObject.Tiles, Vector2.down)) // if current TileObject cant be moved
        {
            // set unmovable for all tiles of current tileObject
            foreach (Tile tile in currentTileObject.Tiles)
            {
                tile.isMovable = false;
            }

            // check if the lines are full
            fieldManager.CheckLines(new HashSet <float>(currentTileObject.Tiles.Select(x => x.position.y)));

            // spawn next TileObject
            spawnManager.SpawnNext();
        }
        else
        {
            CancelInvoke();
            Invoke("DefaultMoveDown", objectMoveDelay);// repeat after delay time
        }
    }