Ejemplo n.º 1
0
        public TerrainEditor(ParentGame parentGame,
            GameplayScreen gameScreen, TerrainEngine terrainEngine)
        {
            this.parentGame = parentGame;
            this.gameScreen = gameScreen;
            this.terrainEngine = terrainEngine;

            posList = new List<Vector3>();
            vectorList = new List<int>();
            BigChangeList = new List<int>();
        }
Ejemplo n.º 2
0
        /// <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();
        }
Ejemplo n.º 3
0
        void LoadTerrain()
        {
            ResourceList LR = parentGame.LoadedResources;
            Dictionary<string, string> LLL = parentGame.Level_Loader.GetLevelLoadList();

            TerrainEngine.TerrainArguments terrainArgument = new TerrainEngine.TerrainArguments();

            terrainArgument.heightMap =         LR.Tex2dList[LLL["Terrain"]];

            terrainArgument.terrainTexture1 = LR.Tex2dList[LLL["TerrainTexture1"]];
            terrainArgument.terrainTexture2 = LR.Tex2dList[LLL["TerrainTexture2"]];
            terrainArgument.terrainTexture3 = LR.Tex2dList[LLL["TerrainTexture3"]];
            terrainArgument.terrainTexture4 = LR.Tex2dList[LLL["TerrainTexture4"]];
            terrainArgument.decalTexture =      LR.Tex2dList[LLL["DecalTexture"]];
            terrainArgument.skyTexture =        LR.Tex2dList[LLL["SkyTexture"]];
            terrainArgument.skyDome =           LR.ModelList[LLL["SkyDome"]].Model_rez;

            terrainArgument.terrainScale = parentGame.Level_Loader.myLevel.terrainScale;

            terrainEngine = new TerrainEngine(
                parentGame,
                MouseCam,
                terrainArgument);
            terrainEngine.LoadContent();

            terrainActor = new TriangleMeshActor(
                parentGame,
                new Vector3(terrainEngine.heightmapPosition.X, 0, terrainEngine.heightmapPosition.Z),
                terrainEngine.terrainScale,
                terrainEngine.heightMap,
                terrainEngine.heightData);
            terrainActor.Body.Immovable = true;
            //terrainActor.Skin.callbackFn += new CollisionCallbackFn(handleCollisionDetection);

            parentGame.Components.Add(terrainActor);
        }