Terraria lighting

sorry for my bad english .
i saw a lot of posts and i can’t solve this problem . i making a 2D sandbox game like Terraria and Starbound . this is my game :

i can make a basic lighting but the lighting if filling the whole terrain .
i want this :

85154-ice-screenshot-20170102-234647.png

someone can help me please ?

Every Tile needs to have access to any of the surroundet tiles. They should have the same Script.
My Full Script for this is not ready, but here are some Pieces:

public GameObject LeftBlock;
public GameObject RightBlock;
public GameObject UpBlock;
public GameObject DownBlock;
public string Improve;
public int Blockvalue;     //Just the identification Number, Blockvalue 0 = air
public int Lightlevel = 5; //The Lightlevel of this Block, 15 = max.
public bool Lighted = false; //Whether a Lightsource is near the Block
private Color LightTone;
private bool Surroundet = false; //Whether the Block is totally surroundet by other Tiles
public bool free = false;
public bool Walled = false;  //Whether the Block touches a background wall
public bool Surroundable = true;
private float FreeFloat;
public bool CHANGE = false;int LightLevelSeek(int Minusint)
{
    int ReturnLevel = 0;
    int Right = 0;
    int Left = 0;
    int Up = 0;
    int Down = 0;
    if (RightBlock != null) { Right = RightBlock.GetComponent<Block>().Lightlevel; }
    if (LeftBlock != null) { Left = LeftBlock.GetComponent<Block>().Lightlevel; }
    if (UpBlock != null) { Up = UpBlock.GetComponent<Block>().Lightlevel; }
    if (DownBlock != null) { Down = DownBlock.GetComponent<Block>().Lightlevel; }
    ReturnLevel = System.Math.Max(System.Math.Max(System.Math.Max(Left, Right), Up), Down);
    return ReturnLevel - Minusint;
}
void Rendering()
{
    if (CHANGE)
    {
        if (RightBlock != null && LeftBlock != null && UpBlock != null && DownBlock != null && Surroundable)
        { Surroundet = true; free = false; }
        if (RightBlock == null || LeftBlock == null || UpBlock == null || DownBlock == null)
        { Surroundet = false; free = false; }
        if (RightBlock == null && LeftBlock == null && UpBlock == null && DownBlock == null)
        { Surroundet = false; free = true; }
        CHANGE = false;
    }
    if (Lighted && Blockvalue != 0)
    { Lightlevel = 15; }
    else if (!Lighted)
    {
        if (Walled || Surroundet)
        {
            if (LightLevelSeek(3) > 0)
            { Lightlevel = LightLevelSeek(3); }
            else
            { Lightlevel = 1; }
        }
        if (!Walled && !Surroundet)
        {
            Lightlevel = 15;
        }
    }
    if (Blockvalue == 0 && Walled)
    {
        FreeFloat = (float)Lightlevel / 15;
        LightTone.a = 1F - FreeFloat;
        GetComponent<SpriteRenderer>().color = LightTone;
    }
    else if (Blockvalue == 0 && !Walled)
    {
        GetComponent<SpriteRenderer>().color = Color.clear;
    }
    else
    {
        LightTone.r = (float)Lightlevel / 15;
        LightTone.g = (float)Lightlevel / 15;
        LightTone.b = (float)Lightlevel / 15;
        GetComponent<SpriteRenderer>().color = LightTone;
    }
}

Hope, that will work, just Update Rendering when The Tile is On the Screen, else it would take too much performance down…