How to make 2D door require a certain amount of coins

Hello I am working on a 2D platformer game and want to make it so that when the player collects 10 coins in level the door will be available to them so that they can go to the next level. I already have the door working to the point where if the player touches it they will be sent to level 2. I couldn’t find a tutorial that explained this properly.

You could have something like this

int coins =  0;

public int Coins
{
    get{return coins;}
    set
    {
        coins = value;
        if (coins == 10)
        {
            OpenDoor();
        }
    }
}

so when you collect a coin you would do a Coins++ or AddCoin()