/// <summary> /// Load your graphics content. If loadAllContent is true, you should /// load content from both ResourceManagementMode pools. Otherwise, just /// load ResourceManagementMode.Manual content. /// </summary> /// <param name="loadAllContent">Which type of content to load.</param> protected override void LoadContent() { //if (loadAllContent) { mSimWorldInstance = SimWorld.GetInstance(); mViewport = graphics.GraphicsDevice.Viewport; //set up the collision detection planes mSimWorldInstance.AddCollisionPlane(new Plane(new Vector3(1.0f, 0.0f, 0.0f), 0.0f)); mSimWorldInstance.AddCollisionPlane(new Plane(new Vector3(-1.0f, 0.0f, 0.0f), mViewport.Width)); mSimWorldInstance.AddCollisionPlane(new Plane(new Vector3(0.0f, 1.0f, 0.0f), 0.0f)); mSimWorldInstance.AddCollisionPlane(new Plane(new Vector3(0.0f, 1.0f, 0.0f), mViewport.Height)); //mouse cursor sprite. mMouseCursor = content.Load <Texture2D>("Images/mouse"); //set up the boid sprites. mSpriteBatch = new SpriteBatch(graphics.GraphicsDevice); //create boids. Random rand = new Random(); for (int i = 0; i < NUMBOIDS; ++i) { Boid newBoid = new Boid(rand.Next(mViewport.Width), rand.Next(mViewport.Height), new FlockStrategy()); newBoid.LoadGraphicAsset(content); mSimWorldInstance.AddBoid(newBoid); } for (int j = 0; j < 10; ++j) { Predator newPredator = new Predator(rand.Next(mViewport.Width), rand.Next(mViewport.Height), new WanderStrategy()); newPredator.LoadGraphicAsset(content); mSimWorldInstance.AddBoid(newPredator); } } }
/// <summary> /// Load your graphics content. If loadAllContent is true, you should /// load content from both ResourceManagementMode pools. Otherwise, just /// load ResourceManagementMode.Manual content. /// </summary> /// <param name="loadAllContent">Which type of content to load.</param> protected override void LoadContent() { //if (loadAllContent) { mSimWorldInstance = SimWorld.GetInstance(); mViewport = graphics.GraphicsDevice.Viewport; //set up the collision detection planes mSimWorldInstance.AddCollisionPlane(new Plane(new Vector3(1.0f, 0.0f, 0.0f), 0.0f)); mSimWorldInstance.AddCollisionPlane(new Plane(new Vector3(-1.0f, 0.0f, 0.0f), mViewport.Width)); mSimWorldInstance.AddCollisionPlane(new Plane(new Vector3(0.0f, 1.0f, 0.0f), 0.0f)); mSimWorldInstance.AddCollisionPlane(new Plane(new Vector3(0.0f, 1.0f, 0.0f), mViewport.Height)); //mouse cursor sprite. mMouseCursor = content.Load<Texture2D>("Images/mouse"); //set up the boid sprites. mSpriteBatch = new SpriteBatch(graphics.GraphicsDevice); //create boids. Random rand = new Random(); for (int i = 0; i < NUMBOIDS; ++i) { Boid newBoid = new Boid(rand.Next(mViewport.Width), rand.Next(mViewport.Height), new FlockStrategy()); newBoid.LoadGraphicAsset(content); mSimWorldInstance.AddBoid(newBoid); } for (int j = 0; j < 10; ++j) { Predator newPredator = new Predator(rand.Next(mViewport.Width), rand.Next(mViewport.Height), new WanderStrategy()); newPredator.LoadGraphicAsset(content); mSimWorldInstance.AddBoid(newPredator); } } }