Exemple #1
0
        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Crear SkyBox
            skyBox = new TgcSkyBox();
            skyBox.Center = new Vector3(0, 500, 0);
            skyBox.Size = new Vector3(10000, 10000, 10000);
            string texturesPath = GuiController.Instance.ExamplesMediaDir + "Texturas\\Quake\\SkyBox LostAtSeaDay\\";
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "lostatseaday_up.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "lostatseaday_dn.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "lostatseaday_lf.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "lostatseaday_rt.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "lostatseaday_bk.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "lostatseaday_ft.jpg");
            skyBox.updateValues();


            //Cargar escenario de Isla
            TgcSceneLoader loader = new TgcSceneLoader();
            TgcScene scene = loader.loadSceneFromFile(GuiController.Instance.ExamplesDir + "Optimizacion\\Isla\\Isla-TgcScene.xml");

            //Separar el Terreno del resto de los objetos
            List<TgcMesh> list1 = new List<TgcMesh>();
            scene.separeteMeshList(new string[] { "Terreno" }, out list1, out objetosIsla);
            terreno = list1[0];

            //Crear Octree
            octree = new Octree();
            octree.create(objetosIsla, scene.BoundingBox);
            octree.createDebugOctreeMeshes();


            //Camara en 1ra persona
            GuiController.Instance.FpsCamera.Enable = true;
            GuiController.Instance.FpsCamera.setCamera(new Vector3(1500, 800, 0), new Vector3(0, 0, -1));
            GuiController.Instance.FpsCamera.MovementSpeed = 500f;
            GuiController.Instance.FpsCamera.JumpSpeed = 500f;

            GuiController.Instance.Modifiers.addBoolean("showOctree", "Show Octree", false);
            GuiController.Instance.Modifiers.addBoolean("showTerrain", "Show Terrain", true);
        }
        public override void init()
        {
            GuiController.Instance.Modifiers.addFloat("zoom", 2f, 5f, 3f);
            GuiController.Instance.Modifiers.addBoolean("huellas", "Mostrar huellas", true);
            GuiController.Instance.Modifiers.addBoolean("nieve", "Mostrar nieve", true);

            Device d3dDevice = GuiController.Instance.D3dDevice;

            juego = Juego.getInstance();
            vida = Vida.getInstance();
            vida.initialize();

            //ppManager = new PostProcesadoManager(this);

            camara = new TgcFpsMiCamara();
            camara.Enable = true;
            camara.setCamera(new Vector3(-200, 40, 0), new Vector3(0, 10, 0));
            camara.MovementSpeed = 150;

            soundManager = SoundManager.getInstance();
            contadorBalas = ContadorBalas.getInstance();
            escenarioManager = new EscenarioManager();

            escenarioManager.generarPosiciones();
            escenarioManager.generarBosque(500, 200, 40);

            octree = new Octree();
            octree.create(escenarioManager.getOptimizables(), escenarioManager.limites);
            octree.createDebugOctreeMeshes();

            enemigosManager = new EnemigosManager(escenarioManager);
            enemigosManager.generarEnemigos(Juego.Instance.totalEnemigos);

            Juego.Instance.manejoEnemigos(enemigosManager);

            contadorEnemigos = new ContadorEnemigos();

            armaManager = ArmaManager.getInstance(enemigosManager, camara, escenarioManager);

            indicadores = new Indicadores();

            camara.setEscenarioManger(escenarioManager);

            finalJuego = new GameOver();

            huellaManager = new HuellasManager(25);

            nieve = new Nieve(3000, 3000, 200);
            clima = new Clima(nieve, soundManager);
        }