Exemple #1
0
    bool SetupStartPositions(TileObject tileObject)
    {
        tileObject.transform.position = startTilePos;

        foreach (Tile tile in tileObject.Tiles) //check if tiles can be moved and set them movable
        {
            if (!fieldManager.CheckFieldPosition((Vector2)tile.transform.position))
            {
                return(false);
            }
            tile.isMovable = true;
        }

        foreach (Tile tile in tileObject.Tiles) // move tiles
        {
            Vector2 prevPos = tile.transform.position;
            tile.position = tile.transform.position;
            fieldManager.ChangeTilePosition(tile, Vector2.zero, tile.position);
        }

        return(true);
    }