Instantiating formula?

Hello. I want to set up the enemy spawning system for my game and I have a three questions:

1:How can I make it so that every 4 seconds, 2 objects are randomly spawned within minimum/maximum/center xyz coordinates from 3 possible prefabs until the total number of objects equals 20?

2: How can I bypass the “spawn every 4 seconds” thing so that if the total number of objects spawned at the current time falls below a certain amount (so that the player doesnt get bored) a certain amount of enemies will spawn instantly, regardless of time?

3: I want to make the script multi-tiered, so the farther the player gets into the game, the tougher it gets. I want a value to increase with every enemy the player defeats (I know how to do that). As the value gets larger, I want the variables of the script to increase. So the script would be set up like this

:if value <20(){ Every 4 seconds, spawn 2 objects until the number of objects spawned at the current time =20 Possible object choices are “Enemy A”, “Enemy B” “Enemy C”

:if value >20 and<40(){ Every 4 seconds, spawn 5 objects until the number of objects spawned at the current time =30 Possible object choices are “Enemy A”, “Enemy B” “Enemy C” “Enemy D” Enemy E" “Enemy F”

Thanks.

The answer to all 3: “scripting”

Feel free to script it however you like, but most likely you’ll need to use elements from the following:

http://unity3d.com/support/documentation/ScriptReference/index.Coroutines_26_Yield.html (simple timing, otherwise you might want to use Time.time or Time.deltaTime depending on how you script it)

Take a shot at it, see if you can script it. If you have specific problems scripting it, feel free to post a specific question. That is, unless you wanted us to write this for you?