/// <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() { table.InitPosition(new Vector3(0, 85, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); baseTable.InitPosition(new Vector3(0, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); ball.InitPosition(new Vector3(0, 86.5f, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0), .2f, .4f, .05f, .05f); maze.InitPosition(new Vector3(0, 85, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); bomb.InitPosition(new Vector3(0, 85, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); ball.ModelNamePath = Globals.config.ballPath; table.ModelNamePath = Globals.config.tablePath; baseTable.ModelNamePath = Globals.config.baseTablePath; maze.ModelNamePath = Globals.config.mazePath; bomb.ModelNamePath = Globals.config.bombPath; for (int i = 0; i < Globals.config.numberOfHoles; i++) { holes[i].InitPosition(new Vector3(Globals.config.holesXposition[i], 85f, Globals.config.holesZposition[i]), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); holes[i].ModelNamePath = Globals.config.holeModelPath; } IsMouseVisible = true; graphics.PreferMultiSampling = true; //GraphicsDevice.PresentationParameters.MultiSampleCount = 16; graphics.ApplyChanges(); cam = new Camera(GraphicsDevice.Viewport.AspectRatio); input = new Input(cam); cam.CameraPosition = new Vector3(0f, 300f, 300f); cam.CameraLookAt = table.Position; cam.CameraUpDir = new Vector3(0f, 1f, 0f); ball.IsBall = true; baseTable.IsStatic = true; base.Initialize(); }
/// <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() { renderTarget = new RenderTargetCube(GraphicsDevice, 512, true, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat); environmentMap.InitPosition(new Vector3(0, 100, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); table.InitPosition(new Vector3(0, 85, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); baseTable.InitPosition(new Vector3(0, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); ball.InitPosition(new Vector3(0, 86.5f, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0), .2f, .4f, .05f, .05f); maze.InitPosition(new Vector3(0, 85, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); ball.ModelNamePath = Globals.config.ballPath; table.ModelNamePath = Globals.config.tablePath; baseTable.ModelNamePath = Globals.config.baseTablePath; maze.ModelNamePath = Globals.config.mazePath; for (int i = 0; i < Globals.config.numberOfHoles; i++) { hole[i].InitPosition(new Vector3(Globals.config.holesXposition[i], 85f, Globals.config.holesZposition[i]), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); hole[i].ModelNamePath = Globals.config.holeModelPath; } for (int i = 0; i < Globals.config.numberOfBombs; i++) { bomb[i].InitPosition(new Vector3(Globals.config.bombsXposition[i], 85f, Globals.config.bombsZposition[i]), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); bomb[i].ModelNamePath = Globals.config.bombModelPath; bombHole[i].InitPosition(new Vector3(Globals.config.bombsXposition[i], 85f, Globals.config.bombsZposition[i]), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); bombHole[i].ModelNamePath = Globals.config.bombHoleModelPath; redButton[i].InitPosition(new Vector3(Globals.config.redButtonXposition[i], 85f, Globals.config.redButtonZposition[i]), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); redButton[i].ModelNamePath = Globals.config.redButtonModelPath; greenButton[i].InitPosition(new Vector3(Globals.config.greenButtonXposition[i], 85f, Globals.config.greenButtonZposition[i]), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); greenButton[i].ModelNamePath = Globals.config.greenButtonModelPath; } for (int i = 0; i < Globals.config.numberOfCheckpoint; i++) { checkpoint[i].InitPosition(new Vector3(Globals.config.checkpointXposition[i], 85f, Globals.config.checkpointZposition[i]), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); checkpoint[i].ModelNamePath = Globals.config.checkpointModelPath; } IsMouseVisible = true; graphics.PreferMultiSampling = true; //GraphicsDevice.PresentationParameters.MultiSampleCount = 16; graphics.ApplyChanges(); cam = new Camera(GraphicsDevice.Viewport.AspectRatio); input = new Input(cam); //cam.CameraPosition = new Vector3(0f, 300f, 300f); cam.CameraLookAt = table.Position; cam.CameraUpDir = new Vector3(0f, 1f, 0f); ball.IsBall = true; baseTable.IsStatic = true; for (int i = 0; i < Globals.config.numberOfBombs; i++) { bomb[i].IsExploded = true; bombHole[i].Visible = false; } checkpointIndex = -1; base.Initialize(); }