public TerrainEngine(ParentGame game, MouseCamera mouseCam, TerrainArguments terrainArgs) { this.device = game.GraphicsDevice; parentGame = game; heightMap = terrainArgs.heightMap; terrainTexture = terrainArgs.terrainTexture1; terrainTexture0 = terrainArgs.terrainTexture2; terrainTexture1 = terrainArgs.terrainTexture3; terrainTexture2 = terrainArgs.terrainTexture4; decalTexture = terrainArgs.decalTexture; terrainScale = terrainArgs.terrainScale; skyDome = terrainArgs.skyDome; cloudMap = terrainArgs.skyTexture; //#if!XBOX // sw = new StreamWriter("C:/Temp_Heights" + parentGame.LevelNum + ".jpeg"); //#endif }
/// <summary> /// Unload graphics content used by the game. /// </summary> public override void UnloadContent() { List<Body> Bodies = new List<Body>(); foreach (Body body in PhysicsSystem.CurrentPhysicsSystem.Bodies) Bodies.Add(body); foreach (Body body in Bodies) PhysicsSystem.CurrentPhysicsSystem.RemoveBody(body); List<CollisionSkin> Skins = new List<CollisionSkin>(); foreach (CollisionSkin skin in PhysicsSystem.CurrentPhysicsSystem.CollisionSystem.CollisionSkins) Skins.Add(skin); foreach (CollisionSkin skin in Skins) PhysicsSystem.CurrentPhysicsSystem.CollisionSystem.RemoveCollisionSkin(skin); parentGame.Components.Remove(terrainActor); terrainActor.Dispose(); NormalDrawing.Unload(); terrainEngine.Unload(); Player.baseRotationValue = 0; Player.cannonRotationValue = 0; Player.turretRotationValue = 0; Player.baseBone.Transform = Matrix.Identity; Player.Unload(); Player = null; MouseCam = null; terrainEngine = null; //LevelVars = null; NormalDrawing = null; //ambieCue = parentGame.soundBank.GetCue("ambient"); //ambieCue.Stop(AudioStopOptions.Immediate); if (ambieCue != null && ambieCue.IsPlaying) ambieCue.Stop(AudioStopOptions.Immediate); if (birdCue.IsCreated && birdCue.IsPlaying) birdCue.Stop(AudioStopOptions.Immediate); if (cue != null && cue.IsPlaying) cue.Stop(AudioStopOptions.Immediate); SetScore(); #if XBOX parentGame.SaveGame(); #endif parentGame = null; content.Unload(); }
void LoadCamera() { MouseCam = new MouseCamera(parentGame); MouseCam.LoadContent(); MouseCam.cameraPosition = parentGame.Level_Loader.myLevel.cameraSpawn.Position; MouseCam.leftrightRot = MathHelper.PiOver2; FollowCam = new FollowCam(parentGame, Player); }