Yo
I did some searching around, but it did not yield anything use full.
I would really like to know how one is supposed to create a dynamic Instantiation system, which automatically finds the next set of spawnpoints around you and spawn AIs. Let me brake it down for you my friend:
Theory:
- Player passes a trigger called “Place_AI”
- Find near by spawn points(empty gameObjects)
- Instantiate enemys of different types at said spawn points
However I am having some trouble figuring out the details I guess.
When the player passes the trigger, how would one find the spawn points for AIs close to the players position without “hard coding” it? And how would one easily tell the computer to spawn 2 of these AIs and 3 of these AIs?
What I have now in basic is this:
var count = 0;
var enemy : Transform;
function OnTriggerEnter (hit : Collider) {
if(hit.gameObject.tag == "Place_AI"){
count++;
PlaceAI(count);
}
}
function PlaceAI(count : int){
switch(count){
case count:
Instantiate(enemy, saidSpawnPoints.transform.position, transform.rotation);
break;
}
}
(I know there is a lot of redundancy, no need pointing that out ;))
But how would I find the spawns point relevant to my position dynamically?
And how can I easily tell the computer to Instantiate x of these AIs and y of these AIs? While everything is as dynamic as possible(meaning not hard coded).
I hope you get what I am saying. I could really appreciate some help on this one.
Thank you.