/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here entityList = new List <Entity>(); Rectangle rectangle = new Rectangle(-BoundingBoxExpansion, -BoundingBoxExpansion, GraphicsDevice.Viewport.Width + BoundingBoxExpansion, GraphicsDevice.Viewport.Height + BoundingBoxExpansion); Random r = new Random(); Entity e1 = new Entity(rectangle, new Vector2(20, 60), EntitySpeed, MaxEntitySpeed, (float)(r.NextDouble() * MathHelper.TwoPi), EntityScale, EntityDetectionDistance, EntitySeparationDistance); Entity e2 = new Entity(rectangle, new Vector2(80, 120), EntitySpeed, MaxEntitySpeed, (float)(r.NextDouble() * MathHelper.TwoPi), EntityScale, EntityDetectionDistance, EntitySeparationDistance); Entity e3 = new Entity(rectangle, new Vector2(60, 140), EntitySpeed, MaxEntitySpeed, (float)(r.NextDouble() * MathHelper.TwoPi), EntityScale, EntityDetectionDistance, EntitySeparationDistance); //Avoid finding new neighbors at runtime, so we are generating the flock ahead of time Flock f = new Flock(e1, null); e1.Flock = f; e1.IsFlockLeader = true; e1.InFlock = true; f.AddMember(e2); e2.Flock = f; e2.InFlock = true; f.AddMember(e3); e3.Flock = f; e3.InFlock = true; entityList.Add(e1); entityList.Add(e2); entityList.Add(e3); base.Initialize(); }