/// <summary> /// Se llama en cada frame. /// Se debe escribir toda la lógica de computo del modelo, así como también verificar entradas del usuario y reacciones /// ante ellas. /// </summary> public override void Update() { PreUpdate(); SkyBoxUpdate(); if (FinishedLoading) { Niebla.Update(Camara); } //le mando el input al auto del jugador parar que haga lo que tenga que hacer. if (GodModeOn == false) { AutoJugador.Update(Input); } if (GodModeOn) { if (Input.keyPressed(Key.Z)) { AutoJugador.Acelero(1.4f); } } //Capturar Input teclado if (Input.keyPressed(Key.F)) { BoundingBox = !BoundingBox; } if (Input.keyPressed(Key.L)) { AutoJugador.RenderLuces = !AutoJugador.RenderLuces; lucesPrendidas = !lucesPrendidas; } // Ir al menu? if (Input.keyPressed(Key.P)) { //Niebla.CargarCamara(Camara); } //Capturar Input Mouse if (Input.buttonUp(TgcD3dInput.MouseButtons.BUTTON_LEFT)) { } //godMode Toggle if (Input.keyPressed(Key.O)) { ToggleGodCamera(); } autoOponente.Update(AutoJugador.Mesh.Position); //LucesLst[0].Update(AutoJugador.Mesh.Position, AutoJugador.Mesh.Rotation); }
/// <summary> /// Activa/desactiva la camara de modo dios, cuando la activo el juego sigue funcionando. /// </summary> private void ToggleGodCamera() { if (GodModeOn) { GodModeOn = false; Camara = AutoJugador.camaraSeguirEsteAuto(this); // apagar godmode y volver al auto } else { GodModeOn = true; var cameraPosition = new Vector3(100, 100, 100); Camara = new GodCamera(cameraPosition, Input); } }
/// <summary> /// main render method /// </summary> public override void Render() { BorrarPantalla(); if (showMenu) { //TODO -> mostrar menu inicial return; } if (!FinishedLoading) { return; } crono.render(ElapsedTime); preRenderPointLight(); //render 1 //preRenderNiebla(); //render2, rompe con la luz por eso esta comentado IniciarScene(); //empiezo main escena //cilindroBB.render(); //PreRenderPersonalizado(); //para el shadowMapFIX if (GodModeOn) { DibujarDebug(); } var posCamara = AutoJugador.CamaraAuto.Position; //foreach (Auto a in Autos) //{ // foreach (LuzFija luz in LucesLst) // { // luz.setValues(a.Mesh, posCamara); // } // a.Render(); //} foreach (TgcMesh mesh in MapScene.Meshes) { //rendereo solo lo que esta dentro del frustrum var c = TgcCollisionUtils.classifyFrustumAABB(Frustum, mesh.BoundingBox); if (c != TgcCollisionUtils.FrustumResult.OUTSIDE) { mesh.render(); } } DrawText.drawText(AutoJugador.Velocidad.ToString(), 20, 50, Color.Orange); //skybox render //render de menubox solo cuando es necesario. if (GodModeOn == true && MenuBox != null) { MenuBox.Render(); } //Dibujo los sprites2d en pantalla Velocimetro.Render(); autoOponente.render(); SkyBox.render(); RenderAxis(); RenderFPS(); AutoJugador.Render(); TerminarScene(); //termino main scene ImprimirPantalla(); }