OnCollisionEnter as IEnumerator problem (WaitForSecond)

Hello there! It’s me with my seemingly endless Unity problems. This time, I want to create a WaitForSecond function inside an OnCollisionEnter function. So naturally I changed it into IEnumerator. But the WaitForSecond still doesn’t occur. What seems to be the problem here?

	void Start() {
	//StartCoroutine("OnCollisionEnter", ????);
}
IEnumerator OnCollisionEnter (Collision coll) {
	    if(coll.gameObject.tag == "bullet") 
	{
	    hitPoints -= bulletDamage;
	} 

		if (hitPoints <= 0 && enemy == true)
	{ 
		Instantiate(explosionPrefab, transform.position, transform.rotation);
	    Destroy(gameObject); // YES, the object destroyed.
		yield return new WaitForSeconds(1); // NO, it didn't wait.
		Time.timeScale = 0; // NO, this didn't happen also.
		info.text = "YOU WIN!"; //NO.
	}
}

As you can see I’ve also tried to call the function with StartCoroutine but I can’t figure out what parameter should I put into the bracket. Sounds noobish? I am one. Any kinds of help appreciated!

I would suggest that instead of trying to change the whole function of OnCollisionEnter, just use a Invoke().

http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.Invoke.html

void OnCollisionEnter (Collision coll) {
  //do something
  Invoke("MyWaitingFunction",10); //this would make it wait 10 seconds then run the function called "MyWaitingFunction"
}

void MyWaitingFunction()
{
  //Stuff here happens after 10 seconds of the collision.
}

Good Luck!

You’re destroying the gameobject to which this script is attached, thus nothing more will happen. If you really want to suicide this object, the instructions after Destroy should be in another script, attached to another object.

       ...
       Destroy(gameObject); // <- this object (and this script) get destroyed
       // this yield may start executing, but before the next update
       // the whole script will disappear
       yield return new WaitForSeconds(1);
       Time.timeScale = 0; // NO, this didn't happen also.
       info.text = "YOU WIN!"; //NO.
    }