Decrase value on collision C#

I got a Health Script from BurgZergArcade.
And I need something that decrase the curHealth when the enemy (with tag “Enemy”) will touch me, for example -10.
Also, some delay between decrasing curHealth would be nice c:

Health Script:

using UnityEngine;
using System.Collections;

public class PlayerHealth : MonoBehaviour {
public int maxHealth = 100; //maximum  HP
public int curHealth = 100; //current HP

public float healthBarLength;

// Use this for initialization
void Start () {
healthBarLength = Screen.width / 2;
}

// Update is called once per frame
void Update () {
AddjustCurrentHealth (0);
}
void OnGUI(){
GUI.Box(new Rect(10, 10, healthBarLength, 20), curHealth + "/" + maxHealth); 
}

public void AddjustCurrentHealth(int adj) {
curHealth += adj;

if(curHealth < 0)
curHealth = 0;

if (curHealth > maxHealth)
maxHealth = 1;

healthBarLength = (Screen.width / 2) * (curHealth / (float)maxHealth);
}
}

Collision detection is done (in script) using events sent by Unity engine. For example OnCollisionEnter is sent to the GameObject with a Collider component attached or to the parent Rigidbody when using compound colliders.

Once you know that, you can try a dummy solution like:

void OnCollisionEnter(Collision collision)
{
    curHealth -= 10;
}

Of course, you may now want to check the kind of object that you collided with. In order to do that, you can check the name or the tag of the collided object.

String tag = collision.gameObject.tag;
if (tag == "Enemy")

And finally, to make sure that you decrease the value nex timte only after a certain amount of time, you need to use the so-called Time class.

Each time you change the value, you can store the time that event occured:

lastChangeTime = Time.time;

Next attempt to change the value, you check the time elapsed since the previous change:

if (Time.time - lastChangeTime > aCertainAmountOfTime)
{
    // change the value
    AdjustHealth(-10);
    // save the 'last change time'
    lastChangeTime = Time.time;
}

With all that, I’m sure you can write your own solution.

You are looking for OnCollisionEnter

	void OnCollisionEnter(Collision collision)
	{
		if (collision.gameObject.tag == "Enemy")
		{
			AdjustCurrentHealth(-10);
		}
	}

Also, you will need a rigidbody attached (it’s a physics collision). And remove the AdjustCurrentHealth from Update.

For a time delay:

IEnumerator AdjustCurrentHealth(int adj)
{
    yield return new WaitForSeconds(5);
    ...

Then StartCoroutine(AdjustCurrentHealth(-10)); where it was before.