Exemplo n.º 1
0
    private bool CreateTile(int row, int column, int shapeCode, int textureVariation, ref GameObject tileObject,
                            ref Tile tileComponent)
    {
        Vector3 tileObjectPosition = Vector3.zero;

        if (tileFactory != null)
        {
            tileObject = tileFactory.GetTileByShapeCode(shapeCode, textureVariation, ref tileComponent);
            if (tileObject != null)
            {
                tileObject.transform.SetParent(gameObject.transform, false);
                tileObjectPosition.x = (column + 0.5f) * tileWidth;
                tileObjectPosition.y = -1f * (row + 0.5f) * tileHeight;
                tileObjectPosition.z = 0f;
                tileObject.transform.localPosition = tileObjectPosition;
                return(true);
            }
        }
        return(false);
    }