mirror of
https://github.com/Xevion/Boids.git
synced 2025-12-14 02:11:05 -06:00
make most Boid properties private, use Renderer check for Wrapping visibility, broke ScreenWrap functionality again, Boid GameObject sibling index based naming, many new comments
This commit is contained in:
@@ -43,14 +43,16 @@ public class BoidController : MonoBehaviour {
|
||||
|
||||
// Add in Boid Objects / Spawn Boid Prefabs
|
||||
for (int i = 0; i < boidCount; i++) {
|
||||
// Generate a new position within the Rect boundaries (minus a little)
|
||||
var position = new Vector2(
|
||||
Random.Range(-space.size.x, space.size.x) / 2 * 0.95f,
|
||||
Random.Range(-space.size.y, space.size.y) / 2 * 0.95f);
|
||||
// Spawn a new Boid prefab
|
||||
GameObject boid = Instantiate(boidObject, position, Quaternion.identity);
|
||||
|
||||
// Set parent, add Boid component to Boids list
|
||||
boid.transform.parent = transform;
|
||||
boids.Add(boid.GetComponent<Boid>());
|
||||
boids[boids.Count - 1].position = position;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user