//players = 1 or 2 //sections = 1,2 or 3 (small, medium, long) ---> has scaling factor. default set to 6 //difficulty = 1, 2, or 3 (easy, medium, hard) public GameLayer(int players, int numSections, int difficulty) : base() { cooloffBlue = 2000; cooloffGreen = 2000; // Screen layer attributes numPlayers = players; numSectionScalingFactor = 6; isTransparent = false; transitionOnTime = TimeSpan.FromSeconds(0.6); transitionOffTime = TimeSpan.FromSeconds(0.5); // 3D view vars viewport = Globals.graphics.GraphicsDevice.Viewport; // drawable layers canvas = new SpriteBatch(Globals.graphics.GraphicsDevice); game3DLayer = new RenderTarget2D( Globals.graphics.GraphicsDevice, viewport.Width, viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents); // Create the renderer, this renderer binds to the graphics device and with the given width and height, is used to // draw everything on each frame renderer = new Renderer(Globals.graphics.GraphicsDevice, Globals.content, viewport.Width, viewport.Height); // The light and mesh container is used to store mesh and light obejcts. This is just for RENDERING. Not for DRAWING sceneGraph = new BlockBasedSceneGraph(numSections * numSectionScalingFactor); sceneGraph.SetSubMeshDelegate(delegate(Mesh.SubMesh subMesh) { renderer.SetupSubMesh(subMesh); subMesh.RenderEffect.AmbientParameter.SetValue(Vector4.Zero); }); sceneGraph.SetLightDelegate(delegate(Light l) { }); // Load the Game //second number is number of players Globals.gameInstance = new RealGame(numSections * numSectionScalingFactor, numPlayers, sceneGraph); cameraController = new CameraController(viewport, Matrix.Identity); cameraController.Fit(Globals.gameInstance.GetCriticalPoints()); cameraController.MoveToTarget(); }