public void addResource(float x, float y) { if (gameWorld.EntityManager.GetAll(typeof(Resource)).Count <= 1000) { Resource res = new Resource(this, x, y); res.LoadContent(gameWorld.GameRef.Content); gameWorld.EntityManager.AddEntity(res); } }
public void addResource(Resource resource) { if (gameWorld.EntityManager.GetAll(typeof(Resource)).Count <= 1000) { float x = resource.Position.X + Randomiser.nextInt(-25, 25); float y = resource.Position.Y + Randomiser.nextInt(-25, 25); if (!Game1.ScreenBounds.Contains((int)x, (int)y)) { addResource(resource); } else { Resource res = new Resource(this, x, y, resource.Texture); res.LoadContent(gameWorld.GameRef.Content); gameWorld.EntityManager.AddEntity(res); } } }