Hey guys.
Im trying to create a simple system to randomly generate a level from a bunch of prefabs i have made. i have a simple script that is attached to empty game objects spaced 40 units apart along the Z axis. Once i figure this out i will use it to generate more complex levels with corner peices and “T” connectors, but for simplicity sake lets just pretend the level just goes straight along the Z axis. This script is attached to an empty game object and it spawns a prefab that is just a room with 2 doors, perfectly centered, i can repeat this process to keep placing my rooms along the Z axis:
var node1 : Transform;
var block : GameObject;
function Start () {
spawnBlock();
}
function spawnBlock () {
Instantiate(block,node1.transform.position,node1.transform.rotation);
}
So i have 10 empty game objects with this script in a row, but how can i rig it so that it will spawn different prefabs (same size, just different geometry) without a chance of using the same room twice?