Ejemplo n.º 1
0
        public override void Init()
        {
            VariablesGlobales.vidas       = 8;
            VariablesGlobales.mediaDir    = this.MediaDir;
            VariablesGlobales.shadersDir  = this.ShadersDir;
            VariablesGlobales.soundDevice = DirectSound.DsDevice;
            VariablesGlobales.loader      = new TgcSceneLoader();

            hud = new HUD();
            //var d3dDevice = D3DDevice.Instance.Device;

            VariablesGlobales.cues_relative_position = new TGCVector2(.05f, .5f);
            VariablesGlobales.cues_relative_scale    = .3f;

            //Shaders & Post-processing @@ ver como hacer pa q estos se carguen primero!!!!
            shaderManager = new ShaderManager();
            VariablesGlobales.shaderManager = shaderManager;//@@@@@TERMINAR: PONERSELO A TODOS LOS MESHES
            postProcess = new PostProcess(this, shaderManager);
            VariablesGlobales.postProcess = postProcess;
            renderer = new Renderer(this, postProcess);

            /*
             * D3DDevice.Instance.Device.Transform.Projection = TGCMatrix.PerspectiveFovLH(D3DDevice.Instance.FieldOfView, D3DDevice.Instance.AspectRatio,
             *      D3DDevice.Instance.ZNearPlaneDistance, D3DDevice.Instance.ZFarPlaneDistance).ToMatrix();
             */
            physicsEngine = new PhysicsEngine();
            VariablesGlobales.physicsEngine = physicsEngine;

            managerSonido = SoundManager.GetInstance();
            VariablesGlobales.managerSonido = managerSonido;


            //VariablesGlobales.elapsedTime debe ser actualizado por tanto va a Update()

            managerElementosTemporales = new TemporaryElementManager();
            VariablesGlobales.managerElementosTemporales = managerElementosTemporales;

            xwing = new Xwing(VariablesGlobales.loader, new TGCVector3(0, 500, 1000));
            VariablesGlobales.xwing = xwing;

            VariablesGlobales.miniMap.agregarTarget(xwing);

            managerEnemigos = new EnemyManager();
            VariablesGlobales.managerEnemigos = managerEnemigos;
            ColocarXwingEnemigos();
            pistaReferencia = new MainRunway(VariablesGlobales.loader, 5, this.Frustum, xwing);

            worldSphere     = new WorldSphere(VariablesGlobales.loader, xwing);
            followingCamera = new FollowingCamera(xwing);

            VariablesGlobales.camara = followingCamera;

            boundingBoxHelper = new BoundingBoxHelper(new SceneElement[] { xwing, pistaReferencia, worldSphere }, new ActiveElementManager[] { managerElementosTemporales });
            cues = new CueManager(new Cue(new DelayCueLauncher(3), "Bitmaps\\WASD.png", VariablesGlobales.cues_relative_scale, VariablesGlobales.cues_relative_position, 3),
                                  new Cue(new DelayCueLauncher(3), "Bitmaps\\Pause.png", VariablesGlobales.cues_relative_scale, VariablesGlobales.cues_relative_position, 3),
                                  new Cue(new DelayCueLauncher(3), "Bitmaps\\Left_Mouse.png", VariablesGlobales.cues_relative_scale, VariablesGlobales.cues_relative_position, 3)
                                  );
            dynamicCueManager = new DynamicCueManager(new Cue(new PositionAABBCueLauncher(xwing, new TGCVector3(0, -30, -13200), new TGCVector3(100, 100, 100)),
                                                              "Bitmaps\\G_Bomb.png", VariablesGlobales.cues_relative_scale, VariablesGlobales.cues_relative_position, 5));
            postProcess.AgregarElemento(xwing);
            postProcess.AgregarElemento(managerElementosTemporales);
            hole = new Hole(new TGCVector3(0, -40, -13875));
            postProcess.AgregarElemento(hole);
            VariablesGlobales.miniMap.agregarObjetoMeta(hole);

            endGameManager = new EndgameManager(this, new EndGameTrigger(new TGCVector3(0, -50, -13900), new TGCVector3(100, 100, 100)),
                                                new LostGameTrigger(xwing, new TGCVector3(0, -30, -14000)));
            VariablesGlobales.endgameManager = endGameManager;

            managerMenu = new MenuManager(new StartMenu(Key.Return), new PauseMenu(Key.Escape));//tiene q ir ultimo pa parar el resto de sonidos
            VariablesGlobales.managerMenu = managerMenu;

            backgroundSceneLeft  = new BackgroundScene(new TGCVector3(500, 100, 1000), new TGCVector3(200, 200, -15000), 100);
            backgroundSceneRight = new BackgroundScene(new TGCVector3(-600, 100, 1000), new TGCVector3(200, 200, -15000), 100);
            backgroundSceneFront = new BackgroundScene(new TGCVector3(500, 100, -15000), new TGCVector3(-1000, 200, -200), 100);
        }