void OnTileAdditionWorkDone(TileAddition addition)
    {
        Tile tile = addition.tile;
        // For now we just set an alpha texture, later on we could do stages of progress based on the buildpercentage
        // At this point we know that there is a gameobject to render the new tile addition;

        //

        GameObject addition_go = additionGOMap [addition.tile];

        addition_go.transform.eulerAngles = new Vector3(0, 0, addition.Orientation);

        SpriteRenderer spriteRenderer = additionGOMap[tile].GetComponent <SpriteRenderer>();

        spriteRenderer.sprite = addition == null ? null : additionSprites [addition.GetRenderState()];
        Color c = spriteRenderer.color;

        c.a = addition.BuildPercentage == 1 ? 1 : 0.4f;
        spriteRenderer.color = c;
    }
    // Listens to the tile for when the adddition changes, merely updates our listener to start listening to the right addition
    void OnTileAdditionChanged(Tile tile, TileAddition oldAddition, TileAddition newAddition)
    {
        if (newAddition == null)
        {
            // No addition is present here anymore, just disable the SR for now (no need to delete the game object, we might need it later?)
            if (additionGOMap.ContainsKey(tile) == false)
            {
                return;
            }
            additionGOMap[tile].GetComponent <SpriteRenderer>().sprite = null;
            return;
        }

        if (additionGOMap.ContainsKey(tile) == false)
        {
            // There is no gameobject yet to visualise the tile additions for this tile
            // So lets create one
            GameObject additionGO = new GameObject();
            additionGOMap.Add(tile, additionGO);
            additionGO.name = "Addition_" + tile.X + "_" + tile.Y + ": " + (newAddition == null ? "" : newAddition.GetRenderState());
            additionGO.transform.position = new Vector3(tile.X, tile.Y, 0);
            additionGO.transform.SetParent(TileGOMap[tile].transform);
            additionGO.transform.eulerAngles = new Vector3(0, 0, newAddition.Orientation);

            SpriteRenderer sr = additionGO.AddComponent <SpriteRenderer>();
            sr.sprite           = newAddition == null ? null : additionSprites [newAddition.GetRenderState()];
            sr.sortingLayerName = "TileAdditions";
        }
        if (oldAddition != null)
        {
            oldAddition.WorkDone -= OnTileAdditionWorkDone;
        }

        newAddition.WorkDone += OnTileAdditionWorkDone;

        // Manually call OnWorkDone to update the texture
        OnTileAdditionWorkDone(newAddition);
    }
 public override string GetTooltipSpriteName()
 {
     return(proto == null ? null : proto.GetRenderState());
 }