1) Spawn enemies along a circular perimeter around a Vector3 point.
2) Vary the distance from the point.
If that is the best way, could someone help convert it to C#?
Here it is again:
function RandomCircle(center:Vector3, radius:float): Vector3 {
// create random angle between 0 to 360 degrees
var ang = Random.value * 360;
var pos: Vector3;
pos.x = center.x + radius * Mathf.Sin(ang * Mathf.Deg2Rad);
pos.y = center.y + radius * Mathf.Cos(ang * Mathf.Deg2Rad);
pos.z = center.z;
return pos;
}
// How to use:
var center = transform.position;
for (i = 0; i < numObjects; i++){
var pos = RandomCircle(center, 10);
// make the object face the center
var rot = Quaternion.FromToRotation(Vector3.forward, center-pos);
Instantiate(prefab, pos, rot);
}