How can I add an extra life?

I am currently trying to make a collectible when all coins have passed then you would get an extra life there. Maybe someone knows how I should go fix?

below I have a small example was added.

//// example /////

void OnGUI()
{

string split = Application.loadedLevelName.Split(“_”[0]);

	if(levelwon)

	{
		Logic logic = GameObject.Find("Logic").GetComponent("Logic") as Logic;

		if(logic.GetBasherScore(9)== true)
		{
			GUI.DrawTexture(new Rect(Screen.width/2-280,20,80,80), trophy);		
		}
		for(int i=1; i<7; i++)
		{
			if(logic.GetBasherScore(i)== true)
			{
				GUI.DrawTexture(new Rect(bbposx[i-1],bbposy[i-1],40,40), bbmunten[i-1]);
			}
			
		}

you could have a script on each collectible that prompt a function on your main script.

// collectibleScript.cs

function OnCollisionEnter(collision : Collision){
      if(collision.tag.equals("Player"){
           mainScript.addCollectible();
           Destroy(gameObject);
      }
}

// mainScript.cs

var totalCollectibles : int = 20;
var currentCollected : int = 0;
var life : int = 3;
function addCollectible(){
currentCollected++;
if(currentCollected == totalCollectibles)
    life++;
}

EDIT: Woops, forgot to write in C#, but should be easy to translate