how do i make a script that can be applied to blocks and mine them like in minecraft

im trying to make a game like minecraft but im having trouble with some things how do i make a script that all i have to do is add it to a cube and set how strong it is like dirt or stone intesity and add it to a invetory plz help

Something along the lines of

var cubeStrength : float;

function OnCollisionEnter() {

 cubeStrength --;

if (cubeStrength <= 0) {

   Destroy (gameObject);

}
}

Simply apply this code to the cube, set a strength in the inspector window (higher number for stronger material).

Each time you hit the cube the cubeStrength will be decreased by one point. Once the value hits 0 it will be destroyed.