public void Init(TgcD3dInput Input)
        {
            crearTableroPicking(5, 9);

            pickingRay = new TgcPickingRay(Input);

            //Crear caja para marcar en que lugar hubo colision
            collisionPointMesh = TGCBox.fromSize(new TGCVector3(3, 3, 3), Color.Red);
            collisionPointMesh.AutoTransform = true;
            selected = false;

            #region configurarEfecto
            efecto = TgcShaders.loadEffect(GameModel.shadersDir + "shaderPlanta.fx");
            #endregion

            #region contenedor
            contenedor           = new TgcSceneLoader().loadSceneFromFile(GameModel.mediaDir + "modelos\\contenedor-TgcScene.xml").Meshes[0];
            contenedor.Scale     = new TGCVector3(45.5f, 45.5f, 45.5f);
            contenedor.Position  = new TGCVector3(-2000f, 400f, -800f);
            contenedor.Effect    = efecto;
            contenedor.Technique = "RenderSceneProgresivo";

            objetos.Add(contenedor);
            //glowObjects.Add(contenedor);

            #endregion

            //este body seria del tablero o isla principal
            body     = FactoryBody.crearBodyIsla();
            callback = new CollisionCallbackIsla(logica);
            logica.addBulletObject(this);

            PostProcess.agregarPostProcessObject(this);
        }
        public Bomba(TGCVector3 posicion, GameLogic logica)
        {
            efecto      = TgcShaders.loadEffect(GameModel.shadersDir + "shaderPlanta.fx");
            this.logica = logica;

            #region configurarObjeto

            bomba           = new TgcSceneLoader().loadSceneFromFile(GameModel.mediaDir + "modelos\\BOMBA-TgcScene.xml").Meshes[0];
            bomba.Scale     = new TGCVector3(40.5f, 80.5f, 40.5f);
            bomba.Effect    = efecto;
            bomba.Technique = tecnicaDefault;
            bomba.Position  = posicion;
            objetos.Add(bomba);

            body     = FactoryBody.crearBodyZombie(new TGCVector3(posicion.X, posicion.Y + 350, posicion.Z));
            callback = new CollisionCallbackFloor(logica, this);
            logica.addBulletObject(this);

            #endregion

            PostProcess.agregarPostProcessObject(this);
        }
Beispiel #3
0
 public Renderer(IRenderizer gamemodel, PostProcess postprocess)
 {
     this.gameModel   = gamemodel;
     this.postProcess = postprocess;
 }
        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);
        }