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:
Xevion
2020-05-16 22:57:00 -05:00
parent 4d00d3b26a
commit 505211b9dc
3 changed files with 65 additions and 69 deletions

View File

@@ -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;
}
}
}