public void init(Vector3 posicion, Vector3 direccion, String escena, Tipo tipo) { this.direccion = direccion; string alumnoMediaFolder = GuiController.Instance.AlumnoEjemplosDir; var loader = new TgcSceneLoader(); mesh = loader.loadSceneFromFile(alumnoMediaFolder + "CucarachaJugosita\\Media\\" + escena).Meshes[0]; mesh.Position = posicion; mesh.AlphaBlendEnable = true; Vector3 direc = direccion - posicion; direc.Y = 0; direc.Normalize(); mesh.rotateY((float)Math.Atan2(direc.X, direc.Z) - mesh.Rotation.Y - Geometry.DegreeToRadian(180f)); text2 = new TgcText2d(); text2.Text = ""; text2.Color = Color.DarkRed; text2.Align = TgcText2d.TextAlign.CENTER; text2.Size = new Size(300, 100); Size screenSize = GuiController.Instance.Panel3d.Size; text2.Position = new Point(screenSize.Width / 2 - text2.Size.Width / 2, screenSize.Height * 6 / 10); text2.changeFont(new System.Drawing.Font("Chiller", /*30*/ GuiController.Instance.D3dDevice.PresentationParameters.BackBufferWidth / 45, FontStyle.Regular)); this.tipo = tipo; }
public EjemploAlumno() { this.escenario = new Escenario(); this.camara = new TgcThirdPersonCamera(); this.llegada = new Vector3(1800, 0, 1700); this.explosion = new Explosion(); this.personaje = new Personaje(this.camara, this.explosion); this.patrulla = new PatrullaPhong(); this.fin = new Fin(); distanceTargetText = new TgcText2d(); distanceTargetText.Position = new Point(0, 40); distanceTargetText.Color = Color.White; onTargetPosition = new TgcText2d(); onTargetPosition.Position = new Point(0, 60); onTargetPosition.Color = Color.Red; onTargetPosition.Text = "Presione la tecla K"; lifeText = new TgcText2d(); lifeText.Position = new Point(-400, 400); try { lifeText.changeFont(new System.Drawing.Font(new FontFamily("Asrock7Segment"), 25)); } catch { lifeText.changeFont(new System.Drawing.Font(lifeText.D3dFont.Description.FaceName, 25)); } lifeText.Color = Color.Yellow; }
public override void init() { Device d3dDevice = GuiController.Instance.D3dDevice; //Texto para el sonido actual currentSoundText = new TgcText2d(); currentSoundText.Text = "No sound"; currentSoundText.Position = new Point(50, 20); currentSoundText.Color = Color.Gold; currentSoundText.changeFont(new System.Drawing.Font(FontFamily.GenericMonospace, 16, FontStyle.Italic)); //Texto de instrucciones instruccionesText = new TgcText2d(); instruccionesText.Text = "Y = Play, O = Stop."; instruccionesText.Position = new Point(50, 60); instruccionesText.Color = Color.Green; instruccionesText.changeFont(new System.Drawing.Font(FontFamily.GenericMonospace, 16, FontStyle.Bold)); //Modifier para archivo MP3 currentFile = null; GuiController.Instance.Modifiers.addFile("WAV-File", GuiController.Instance.ExamplesMediaDir + "Sound\\campanadas horas.wav", "WAVs|*.wav"); //Modifier para loop GuiController.Instance.Modifiers.addBoolean("PlayLoop", "Play Loop", false); }
public static void cargar() { SpriteDrawer = new Drawer2D(); //AnimatedSprite = new TgcAnimatedSprite(Utiles.getDirExtras("Explosion.png"), new Size(64, 64), 16, 10); //AnimatedSprite.Position = new Vector2(GuiController.Instance.Panel3d.Width - 32*2, 0); //Crear Sprite sprite = new TgcSprite(); sprite.Texture = TgcTexture.createTexture(Utiles.getDirExtras("calabera1.jpg")); //Ubicarlo centrado en la pantalla Size screenSize = GuiController.Instance.Panel3d.Size; Size textureSize = sprite.Texture.Size; sprite.Position = new Vector2(GuiController.Instance.Panel3d.Width - 34 * 2, 0); sprite.Scaling = new Vector2(0.1f, 0.1f); Puntos2d = new TgcText2d(); Puntos2d.Text = puntos.ToString(); Puntos2d.Color = Color.Yellow; Puntos2d.Align = TgcText2d.TextAlign.RIGHT; Puntos2d.Position = new Point(GuiController.Instance.Panel3d.Width - 32, 0); Puntos2d.Size = new Size(30, 20); Puntos2d.changeFont(new System.Drawing.Font("Sans-serif ", 15, FontStyle.Bold)); }
public override void Init() { //Cargar mesh var loader = new TgcSceneLoader(); mesh = loader.loadSceneFromFile(MediaDir + "ModelosTgc\\LogoTGC\\LogoTGC-TgcScene.xml").Meshes[0]; //Cargar Shader de PhongShading mesh.Effect = TgcShaders.Instance.TgcMeshPhongShader; mesh.Technique = TgcShaders.Instance.getTgcMeshTechnique(mesh.RenderType); //Texto help textHelp = new TgcText2d(); textHelp.Position = new Point(15, 260); textHelp.Size = new Size(500, 100); textHelp.changeFont(new Font("TimesNewRoman", 16, FontStyle.Regular)); textHelp.Color = Color.Yellow; textHelp.Align = TgcText2d.TextAlign.LEFT; textHelp.Text = "¿Por dónde empezar? Presionar \"H\""; //Help form var helpRtf = File.ReadAllText(MediaDir + "ModelosTgc\\LogoTGC\\help.rtf"); helpForm = new EjemploDefaultHelpForm(helpRtf); //Camara Camara = new TgcRotationalCamera(new Vector3(), 150f); }
private void LoadUI(Size screenSize) { //Texto Vidas (TODO: Agregar Sprites de corazones o algo asi) tvidas = new TgcText2d(); tvidas.Color = Color.Crimson; tvidas.Align = TgcText2d.TextAlign.LEFT; tvidas.Position = new Point(screenSize.Width - 250, screenSize.Height - 80); tvidas.Size = new Size(300, 100); tvidas.changeFont(new System.Drawing.Font("TimesNewRoman", 22, FontStyle.Bold)); //Texto Ammo (Lo mismo pero con balas) tammo = new TgcText2d(); tammo.Color = Color.CornflowerBlue; tammo.Align = TgcText2d.TextAlign.LEFT; tammo.Position = new Point(screenSize.Width - 500, screenSize.Height - 80); tammo.Size = new Size(300, 100); tammo.changeFont(new System.Drawing.Font("TimesNewRoman", 22, FontStyle.Bold)); //Texto Puntos (Ver bien como hacer para diferenciar muerte, headshot y cuerpo) tpuntos = new TgcText2d(); tpuntos.Color = Color.Olive; tpuntos.Align = TgcText2d.TextAlign.LEFT; tpuntos.Position = new Point(screenSize.Width - 250, 0); tpuntos.Size = new Size(300, 100); tpuntos.changeFont(new System.Drawing.Font("TimesNewRoman", 22, FontStyle.Bold)); }
public override void init() { Device d3dDevice = GuiController.Instance.D3dDevice; try { tgcKinect = new TgcKinect(); tgcKinect.init(); tgcKinect.DebugSkeleton.init(); } catch (Exception) { GuiController.Instance.Logger.logError("No se detecto KINECT"); } text = new TgcText2d(); text.Position = new Point(30, 30); text.Color = Color.Red; text.changeFont(new System.Drawing.Font(FontFamily.GenericMonospace, 36, FontStyle.Bold)); text.Text = "Nada"; text.Size = new Size(300, 100); gestoDetectado = false; acumTime = 0; showAcumTime = 0; GuiController.Instance.FpsCamera.Enable = true; GuiController.Instance.FpsCamera.setCamera(new Vector3(10.2881f, 1f, 9.6917f), new Vector3(10.2427f, 1.0175f, 10.6906f)); GuiController.Instance.Modifiers.addFloat("diff", -1f, -0.1f, -0.37f); }
internal override void Init() { int ScreenWidth = GuiController.Instance.D3dDevice.Viewport.Width; int ScreenHeight = GuiController.Instance.D3dDevice.Viewport.Height; int widthRatio = ScreenWidth * 100 / 1126; int heightRatio = ScreenHeight * 100 / 617; instrucciones = new TgcText2d(); instrucciones.Text = @" El objetivo del juego es sobrevivir la mayor cantidad de tiempo posible y sumar puntos, el juego termina cuando el jugador es alcanzado por los enemigos y pierde toda su vida. Presionar L para capturar el mouse. WASD para moverse. L-Shift Para correr. Click izqierdo para disparar, derecho para hacer zoom. N para activar NightVision, Q para cambiar de arma. Para Debug: F6 para dibujar AABB, F7 para activar GodMode. P para aumentar velocidad de Vuelo, O para decrementar."; instrucciones.Color = Color.Crimson; instrucciones.Align = TgcText2d.TextAlign.LEFT; instrucciones.Position = new Point(0 * widthRatio / 100, 300 * heightRatio / 100); instrucciones.changeFont(new System.Drawing.Font("TimesNewRoman", 15, FontStyle.Bold)); TgcText2d backText = new TgcText2d(); backText.Text = "Back"; backText.Color = Color.Crimson; backText.Align = TgcText2d.TextAlign.LEFT; backText.Position = new Point(100 * widthRatio / 100, 500 * heightRatio / 100); backText.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold)); texts = new TgcText2d[1] { backText }; base.Init(); }
public Menu() { fondo.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "Barco-Pirata-Menu.jpg"); fondo.Position = new Vector2(0, 0); fondo.Scaling = new Vector2( (float)GuiController.Instance.Panel3d.Width / fondo.Texture.Width, (float)GuiController.Instance.Panel3d.Height / fondo.Texture.Height); titulo = new TgcText2d(); titulo.Text = "Barco Pirata"; titulo.Color = Color.Gold; titulo.Align = TgcText2d.TextAlign.CENTER; titulo.Position = new Point(200, 100); titulo.Size = new Size(800, 300); titulo.changeFont(new System.Drawing.Font("BlackoakStd", 35, FontStyle.Bold | FontStyle.Italic)); sombra = new TgcText2d(); sombra.Text = "Barco Pirata"; sombra.Color = Color.Chocolate; sombra.Align = TgcText2d.TextAlign.CENTER; sombra.Position = new Point(205, 103); sombra.Size = new Size(800, 300); sombra.changeFont(new System.Drawing.Font("BlackoakStd", 35, FontStyle.Bold | FontStyle.Italic)); textoComplementario = new TgcText2d(); textoComplementario.Text = "Hacé clic para comenzar a jugar." + '\n' + "Apretá I durante el juego para ver las instrucciones."; textoComplementario.Color = Color.Gold; textoComplementario.Align = TgcText2d.TextAlign.CENTER; textoComplementario.Position = new Point(450, 250); textoComplementario.Size = new Size(300, 100); textoComplementario.changeFont(new System.Drawing.Font("BlackoakStd", 18, FontStyle.Bold | FontStyle.Italic)); }
public override void init() { Device d3dDevice = GuiController.Instance.D3dDevice; //Crear texto 1, básico text1 = new TgcText2d(); text1.Text = "Texto de prueba"; //Crear texto 2, especificando color, alineación, posición, tamaño y fuente. text2 = new TgcText2d(); text2.Text = "Texto largo que no entra en el ancho especificado, y se hace WordWrap."; text2.Color = Color.BlueViolet; text2.Align = TgcText2d.TextAlign.LEFT; text2.Position = new Point(300, 100); text2.Size = new Size(300, 100); text2.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold | FontStyle.Italic)); //Crear texto 3, especificando color, alineación, posición y tamaño. text3 = new TgcText2d(); text3.Text = "Texto alineado a la derecha con color."; text3.Align = TgcText2d.TextAlign.RIGHT; text3.Position = new Point(50, 50); text3.Size = new Size(300, 100); text3.Color = Color.Gold; }
public override void Init() { //Texto para el sonido actual currentSoundText = new TgcText2d(); currentSoundText.Text = "No sound"; currentSoundText.Position = new Point(50, 20); currentSoundText.Color = Color.Gold; currentSoundText.changeFont(new Font(FontFamily.GenericMonospace, 16, FontStyle.Italic)); //Texto de instrucciones instruccionesText = new TgcText2d(); instruccionesText.Text = "Y = Play, O = Stop."; instruccionesText.Position = new Point(50, 60); instruccionesText.Color = Color.Green; instruccionesText.changeFont(new Font(FontFamily.GenericMonospace, 16, FontStyle.Bold)); //Modifier para archivo MP3 currentFile = null; Modifiers.addFile("WAV-File", MediaDir + "Sound\\campanadas horas.wav", "WAVs|*.wav"); //Modifier para loop Modifiers.addBoolean("PlayLoop", "Play Loop", false); var filePath = (string)Modifiers["WAV-File"]; loadSound(filePath); }
private BigLogger() { logger = new TgcText2d(); logger.Align = TgcText2d.TextAlign.LEFT; logger.Color = Color.Black; logger.changeFont(new System.Drawing.Font("verdana", 24, System.Drawing.FontStyle.Bold)); logger.Size = new Size(GuiController.Instance.D3dDevice.Viewport.Width - 20, GuiController.Instance.D3dDevice.Viewport.Height - 20); logger.Position = new Point(20, 20); logger.Text = ""; }
public BarraVida(Vector2 position, string nombre) { this.nombre = new TgcText2d(); this.nombre.Text = nombre; this.nombre.Align = TgcText2d.TextAlign.LEFT; this.nombre.changeFont(new System.Drawing.Font("Tahoma", 17)); crearSprite(); posicionar(position); escalar(1); }
internal override void Init() { int ScreenWidth = GuiController.Instance.D3dDevice.Viewport.Width; int ScreenHeight = GuiController.Instance.D3dDevice.Viewport.Height; int widthRatio = ScreenWidth * 100 / 1126; int heightRatio = ScreenHeight * 100 / 617; grupo = new TgcText2d(); grupo.Text = "Los Borbotones"; grupo.Color = Color.Crimson; grupo.Align = TgcText2d.TextAlign.CENTER; grupo.Position = new Point(0 * widthRatio / 100, 300 * heightRatio / 100); grupo.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold)); integrante1 = new TgcText2d(); integrante1.Text = "Santiago Foster"; integrante1.Color = Color.Crimson; integrante1.Align = TgcText2d.TextAlign.LEFT; integrante1.Position = new Point(300 * widthRatio / 100, 350 * heightRatio / 100); integrante1.changeFont(new System.Drawing.Font("TimesNewRoman", 20, FontStyle.Bold)); integrante2 = new TgcText2d(); integrante2.Text = "Gonzalo Furci"; integrante2.Color = Color.Crimson; integrante2.Align = TgcText2d.TextAlign.LEFT; integrante2.Position = new Point(600 * widthRatio / 100, 350 * heightRatio / 100); integrante2.changeFont(new System.Drawing.Font("TimesNewRoman", 20, FontStyle.Bold)); integrante3 = new TgcText2d(); integrante3.Text = "Diego Quiros"; integrante3.Color = Color.Crimson; integrante3.Align = TgcText2d.TextAlign.LEFT; integrante3.Position = new Point(300 * widthRatio / 100, 400 * heightRatio / 100); integrante3.changeFont(new System.Drawing.Font("TimesNewRoman", 20, FontStyle.Bold)); integrante4 = new TgcText2d(); integrante4.Text = "Martin Loguancio"; integrante4.Color = Color.Crimson; integrante4.Align = TgcText2d.TextAlign.LEFT; integrante4.Position = new Point(600 * widthRatio / 100, 400 * heightRatio / 100); integrante4.changeFont(new System.Drawing.Font("TimesNewRoman", 20, FontStyle.Bold)); TgcText2d backText = new TgcText2d(); backText.Text = "Back"; backText.Color = Color.Crimson; backText.Align = TgcText2d.TextAlign.LEFT; backText.Position = new Point(100 * widthRatio / 100, 500 * heightRatio / 100); backText.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold)); texts = new TgcText2d[1] { backText }; base.Init(); }
public TgcText2d inicializarTextoVelocidad(float velocidad) { text1 = new TgcText2d(); velocidad = this.convertir(velocidad); text1.Text = "velocidad: " + velocidad.ToString(); text1.Color = Color.White; text1.Position = new Point(60, 60); text1.Size = new Size(500, 300); return(text1); }
public TerrainBrush() { SoundEnabled = true; text = new TgcText2d(); text.Align = TgcText2d.TextAlign.RIGHT; text.changeFont(new System.Drawing.Font("Arial", 12, FontStyle.Bold)); bBrush = TgcBox.fromSize(new Vector3(10, 100, 10)); sound = new TgcStaticSound(); sound.loadSound(GuiController.Instance.ExamplesMediaDir + "Sound\\tierra.wav"); }
public VegetationPicker() { label = new TgcText2d(); label.Color = Color.Yellow; label.Align = TgcText2d.TextAlign.LEFT; font = new System.Drawing.Font("Arial", 12, FontStyle.Bold); label.changeFont(font); Rotation = RotationAxis.Y; SoundEnabled = true; sound = new TgcStaticSound(); sound.loadSound(GuiController.Instance.ExamplesMediaDir + "Sound\\pisada arena dcha.wav", -2000); }
public static void Cargar() { SpriteDrawer = new Drawer2D(); AnimatedSprite = new TgcAnimatedSprite(Utiles.TexturasDir("moneda_sprite.png"), new Size(32, 32), 16, 10); AnimatedSprite.Position = new Vector2(GuiController.Instance.Panel3d.Width - 32 * 2, 0); Puntos2d = new TgcText2d(); Puntos2d.Text = Puntos.ToString(); Puntos2d.Color = Color.Yellow; Puntos2d.Align = TgcText2d.TextAlign.RIGHT; Puntos2d.Position = new Point(GuiController.Instance.Panel3d.Width - 32, 0); Puntos2d.Size = new Size(30, 20); Puntos2d.changeFont(new System.Drawing.Font("Sans-serif ", 15, FontStyle.Bold)); }
public void init() { Device d3dDevice = GuiController.Instance.D3dDevice; numeroDeLlaves = 0; recolectadas = 0; textoActual = new TgcText2d(); textoActual.Text = "Llaves:" + recolectadas + "/" + numeroDeLlaves; Size screenSize = GuiController.Instance.Panel3d.Size; //(GuiController.Instance.D3dDevice.PresentationParameters.BackBufferWidth/13000f, GuiController.Instance.D3dDevice.PresentationParameters.BackBufferHeight/ 13000f textoActual.Size = new Size(GuiController.Instance.D3dDevice.PresentationParameters.BackBufferWidth / 13000, GuiController.Instance.D3dDevice.PresentationParameters.BackBufferHeight / 13000); textoActual.Position = new Point(GuiController.Instance.D3dDevice.PresentationParameters.BackBufferWidth * 17 / 20, GuiController.Instance.D3dDevice.PresentationParameters.BackBufferHeight * 83 / 100); // textoActual.Position = new Point(GuiController.Instance.D3dDevice.PresentationParameters.BackBufferWidth * 11/32, GuiController.Instance.D3dDevice.PresentationParameters.BackBufferHeight * 8/10); -->> Esta estaba antes por las dudas new Vector2(); //textoActual.Position = new Point(screenSize.Width - textoActual.Size.Width*31/20, screenSize.Height - textoActual.Size.Height*3/2); textoActual.Color = Color.DarkRed; textoActual.changeFont(new System.Drawing.Font("Chiller", /*30*/ GuiController.Instance.D3dDevice.PresentationParameters.BackBufferWidth / 45, FontStyle.Regular)); }
public Canion(Vector3 pos, float offsetShip, TgcMesh mesh, bool soyPlayer) { meshCanion = mesh; meshCanion.Position = new Vector3(0, offsetShip, 0) + pos; posicion = new Vector3(0, offsetShip, 0) + pos; mesh.AutoTransformEnable = false; texto_elevacion = new TgcText2d(); texto_elevacion.Text = toDegrees(anguloElevacion).ToString() + "º"; texto_elevacion.Color = Color.Gold; texto_elevacion.Align = TgcText2d.TextAlign.CENTER; texto_elevacion.Position = new Point(200, 100); texto_elevacion.Size = new Size(800, 300); texto_elevacion.changeFont(new System.Drawing.Font("BlackoakStd", 35, FontStyle.Bold | FontStyle.Italic)); timer = new Timer(FRECUENCIA_TIRO); this.soyPlayer = soyPlayer; }
public void init(Vector3 posP) { //sonidoAbrir = new Tgc3dSound(GuiController.Instance.AlumnoEjemplosDir + "CucarachaJugosita\\Media\\puerta ruidosa, abrir.wav", meshP.Position); /*sonidoAbrir = new Tgc3dSound(); * sonidoAbrir.loadSound(GuiController.Instance.AlumnoEjemplosDir + "CucarachaJugosita\\Media\\puerta ruidosa, abrir.wav"); * sonidoAbrir.Position = meshP.Position;*/ text2 = new TgcText2d(); text2.Text = ""; text2.Color = Color.DarkRed; text2.Align = TgcText2d.TextAlign.CENTER; //text2.Position = new Point(500, 500); text2.Size = new Size(300, 100); // text2.Size = new Size(GuiController.Instance.D3dDevice.PresentationParameters.BackBufferWidth/13000, GuiController.Instance.D3dDevice.PresentationParameters.BackBufferHeight/13000); Size screenSize = GuiController.Instance.Panel3d.Size; // text2.Position = new Point(screenSize.Width/ 2 - text2.Size.Width / 2, screenSize.Height - text2.Size.Height*3); text2.Position = new Point(screenSize.Width / 2 - text2.Size.Width / 2, screenSize.Height * 6 / 10); text2.changeFont(new System.Drawing.Font("Chiller", /*30*/ GuiController.Instance.D3dDevice.PresentationParameters.BackBufferWidth / 45, FontStyle.Regular)); var loader = new TgcSceneLoader(); string alumnoMediaFolder = GuiController.Instance.AlumnoEjemplosDir; puerta1 = loader.loadSceneFromFile(alumnoMediaFolder + "CucarachaJugosita\\Media\\Component_1-TgcScene.xml"); meshP = puerta1.Meshes[0]; meshP.Position = posP; cobertura1 = loader.loadSceneFromFile(alumnoMediaFolder + "CucarachaJugosita\\Media\\cobertura1-TgcScene.xml"); cobertura2 = loader.loadSceneFromFile(alumnoMediaFolder + "CucarachaJugosita\\Media\\cobertura2-TgcScene.xml"); cobertura3 = loader.loadSceneFromFile(alumnoMediaFolder + "CucarachaJugosita\\Media\\cobertura3-TgcScene.xml"); meshC1 = cobertura1.Meshes[0]; meshC1.Position = posP; meshC2 = cobertura2.Meshes[0]; meshC2.Position = posP; meshC3 = cobertura3.Meshes[0]; meshC3.Position = posP; estado = Estado.Cerrado; contadorAbierta = 500f; sonidoAbrir = new Tgc3dSound(GuiController.Instance.AlumnoEjemplosDir + "CucarachaJugosita\\Media\\puerta ruidosa, abrir.wav", meshP.Position); sonidoAbrir.MinDistance = 10f; }
public override void init() { Device d3dDevice = GuiController.Instance.D3dDevice; //Texto para la musica actual currentMusicText = new TgcText2d(); currentMusicText.Text = "No music"; currentMusicText.Position = new Point(50, 20); currentMusicText.Color = Color.Gold; currentMusicText.changeFont(new System.Drawing.Font(FontFamily.GenericMonospace, 16, FontStyle.Italic)); //Texto para las instrucciones de uso instruccionesText = new TgcText2d(); instruccionesText.Text = "Y = Play, U = Pause, I = Resume, O = Stop."; instruccionesText.Position = new Point(50, 60); instruccionesText.Color = Color.Green; instruccionesText.changeFont(new System.Drawing.Font(FontFamily.GenericMonospace, 16, FontStyle.Bold)); //Modifier para archivo MP3 currentFile = null; GuiController.Instance.Modifiers.addFile("MP3-File", GuiController.Instance.ExamplesMediaDir + "Music\\I am The Money.mp3", "MP3s|*.mp3"); }
override public void init() { tipo = Tipo.Farol; text2 = new TgcText2d(); text2.Text = "100%"; text2.Color = Color.DarkSalmon; text2.Align = TgcText2d.TextAlign.RIGHT; text2.Position = new Point(950, 700); text2.Size = new Size(300, 100); text2.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold | FontStyle.Italic)); string alumnoMediaFolder = GuiController.Instance.AlumnoEjemplosDir; var loader = new TgcSceneLoader(); farol = loader.loadSceneFromFile(alumnoMediaFolder + "CucarachaJugosita\\Media\\FaroleteRecarga-TgcScene.xml"); farol.Meshes[0].Scale = new Vector3(0.8f, 0.8f, 0.8f); farol.Meshes[0].Position = Posicion + new Vector3(-10f, -20f, 17f); Intensity = VALORMAXIMOINTENSIDAD; Attenuation = 0.3f; this.color = Color.Yellow; barra = new Barra(); Encendida = true; }
public override void Init() { //Texto para la musica actual currentMusicText = new TgcText2d(); currentMusicText.Text = "No music"; currentMusicText.Position = new Point(50, 20); currentMusicText.Color = Color.Gold; currentMusicText.changeFont(new Font(FontFamily.GenericMonospace, 16, FontStyle.Italic)); //Texto para las instrucciones de uso instruccionesText = new TgcText2d(); instruccionesText.Text = "Y = Play, U = Pause, I = Resume, O = Stop."; instruccionesText.Position = new Point(50, 60); instruccionesText.Color = Color.Green; instruccionesText.changeFont(new Font(FontFamily.GenericMonospace, 16, FontStyle.Bold)); //Modifier para archivo MP3 currentFile = null; Modifiers.addFile("MP3-File", MediaDir + "Music\\I am The Money.mp3", "MP3s|*.mp3"); mp3Player = new TgcMp3Player(); }
internal override void Init() { int ScreenWidth = GuiController.Instance.D3dDevice.Viewport.Width; int ScreenHeight = GuiController.Instance.D3dDevice.Viewport.Height; int widthRatio = ScreenWidth * 100 / 1126; int heightRatio = ScreenHeight * 100 / 617; playText = new TgcText2d(); playText.Text = "Play"; playText.Color = Color.Crimson; playText.Align = TgcText2d.TextAlign.LEFT; playText.Position = new Point(100 * widthRatio / 100, 330 * heightRatio / 100); playText.changeFont(new System.Drawing.Font("TimesNewRoman", 40, FontStyle.Bold)); helpText = new TgcText2d(); helpText.Text = "Help"; helpText.Color = Color.Crimson; helpText.Align = TgcText2d.TextAlign.LEFT; helpText.Position = new Point(100 * widthRatio / 100, 425 * heightRatio / 100); helpText.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold)); creditsText = new TgcText2d(); creditsText.Text = "Credits"; creditsText.Color = Color.Crimson; creditsText.Align = TgcText2d.TextAlign.LEFT; creditsText.Position = new Point(100 * widthRatio / 100, 500 * heightRatio / 100); creditsText.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold)); highScoreText = new TgcText2d(); highScoreText.Text = "High Score: " + GuiController.Instance.UserVars.getValue("High Score"); highScoreText.Color = Color.Crimson; highScoreText.Position = new Point(375 * widthRatio / 100, 500 * heightRatio / 100); highScoreText.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold)); texts = new TgcText2d[4] { playText, helpText, creditsText, highScoreText }; base.Init(); }
public override void init() { Device d3dDevice = GuiController.Instance.D3dDevice; camera = new TerrainFpsCamera(); Terrain = new SmartTerrain(); this.brush = new DummyBrush(); this.vegetation = new List <TgcMesh>(); modifierPanel = new TerrainEditorModifier("Panel", this); GuiController.Instance.Modifiers.add(modifierPanel); pickingRay = new TgcPickingRay(); ShowVegetation = true; mouseMove = new MouseEventHandler(Panel3d_MouseMove); mouseLeave = new EventHandler(Panel3d_MouseLeave); noBrush = new DummyBrush(); GuiController.Instance.Panel3d.MouseMove += mouseMove; GuiController.Instance.Panel3d.MouseLeave += mouseLeave; //Configurar FPS Camara camera.Enable = true; camera.RotateMouseButton = cameraRotationButton; camera.setCamera(new Vector3(-722.6171f, 495.0046f, -31.2611f), new Vector3(164.9481f, 35.3185f, -61.5394f)); labelFPS = new TgcText2d(); labelFPS.Text = "Press F to go back to edition mode"; labelFPS.changeFont(new System.Drawing.Font("Arial", 12, FontStyle.Bold)); labelFPS.Color = Color.Red; labelFPS.Align = TgcText2d.TextAlign.RIGHT; labelVegetationHidden = new TgcText2d(); labelVegetationHidden.Text = "Press V to show vegetation"; labelVegetationHidden.changeFont(new System.Drawing.Font("Arial", 12, FontStyle.Bold)); labelVegetationHidden.Color = Color.GreenYellow; labelVegetationHidden.Format = DrawTextFormat.Bottom | DrawTextFormat.Center; }
public override void init() { Device d3dDevice = GuiController.Instance.D3dDevice; //Cargar mesh TgcSceneLoader loader = new TgcSceneLoader(); mesh = loader.loadSceneFromFile(GuiController.Instance.ExamplesMediaDir + "ModelosTgc\\LogoTGC\\LogoTGC-TgcScene.xml").Meshes[0]; //Cargar Shader de PhongShading mesh.Effect = GuiController.Instance.Shaders.TgcMeshPhongShader; mesh.Technique = GuiController.Instance.Shaders.getTgcMeshTechnique(mesh.RenderType); //Texto help textHelp = new TgcText2d(); textHelp.Position = new Point(15, 260); textHelp.Size = new Size(500, 100); textHelp.changeFont(new System.Drawing.Font("TimesNewRoman", 16, FontStyle.Regular)); textHelp.Color = Color.Yellow; textHelp.Align = TgcText2d.TextAlign.LEFT; textHelp.Text = "¿Por dónde empezar? Presionar \"H\""; //Help form string helpRtf = File.ReadAllText(GuiController.Instance.ExamplesMediaDir + "ModelosTgc\\LogoTGC\\help.rtf"); helpForm = new EjemploDefaultHelpForm(helpRtf); //Camara GuiController.Instance.RotCamera.Enable = true; GuiController.Instance.RotCamera.CameraCenter = new Vector3(0, 0, 0); GuiController.Instance.RotCamera.CameraDistance = 150; GuiController.Instance.BackgroundColor = Color.Black; }
public PantallaJuego(Auto autito) { /*En PantallaInicio le paso a Pantalla juego con qué auto jugar. Acá lo asigno a la pantalla, cargo el coso * que capta el teclado, creo el Nivel1 y lo pongo en la lista de renderizables, para que sepa con qué * escenario cargarse */ this.auto = autito; auto.mesh.move(new Vector3(0, 0, -3100)); auto.mesh.rotateY(-1.57f); this.entrada = GuiController.Instance.D3dInput; this.nivel = EjemploAlumno.getInstance().getNiveles(0); //Barrita de vida vida = new Imagen(GuiController.Instance.AlumnoEjemplosMediaDir + "LosBorbotones\\vidaPersonaje\\vida.jpg"); barra = new Imagen(GuiController.Instance.AlumnoEjemplosMediaDir + "LosBorbotones\\vidaPersonaje\\fondobarra.png"); barra2 = new Imagen(GuiController.Instance.AlumnoEjemplosMediaDir + "LosBorbotones\\vidaPersonaje\\fondobarra2.png"); vida.setEscala(escalaInicial); barra.setEscala(new Vector2(6.81f, 1f)); barra2.setEscala(new Vector2(6.81f, 1f)); Vector2 posicionbarra = new Vector2(10, 5); vida.setPosicion(new Vector2(155f, 9.3f)); //CUENTA REGRESIVA uno = new Imagen(GuiController.Instance.AlumnoEjemplosMediaDir + "LosBorbotones\\cuentaRegresiva\\1.png"); uno.setCentrarYEscalar(); dos = new Imagen(GuiController.Instance.AlumnoEjemplosMediaDir + "LosBorbotones\\cuentaRegresiva\\2.png"); dos.setCentrarYEscalar(); tres = new Imagen(GuiController.Instance.AlumnoEjemplosMediaDir + "LosBorbotones\\cuentaRegresiva\\3.png"); tres.setCentrarYEscalar(); //Instrucción de misión del juego misionMario = new Imagen(GuiController.Instance.AlumnoEjemplosMediaDir + "LosBorbotones\\Mision\\m_mario.png"); misionMario.setCentrarYEscalar(); misionLuigi = new Imagen(GuiController.Instance.AlumnoEjemplosMediaDir + "LosBorbotones\\Mision\\m_luigi.png"); misionLuigi.setCentrarYEscalar(); // CAMARA TERCERA PERSONA GuiController.Instance.ThirdPersonCamera.Enable = true; GuiController.Instance.ThirdPersonCamera.resetValues(); Vector2 vectorCam = (Vector2)GuiController.Instance.Modifiers["AlturaCamara"]; GuiController.Instance.ThirdPersonCamera.setCamera(auto.mesh.Position, vectorCam.X, vectorCam.Y); GuiController.Instance.ThirdPersonCamera.rotateY(auto.mesh.Rotation.Y); //CARGAR MÚSICA. Musica track = new Musica("ramones.mp3"); this.musica = track; musica.playMusica(); musica.setVolume(35); Shared.debugMode = false; //Puntos de juego puntos = new TgcText2d(); puntos.Text = "0"; puntos.Color = Color.DarkRed; puntos.Align = TgcText2d.TextAlign.RIGHT; puntos.Position = new Point(30, 30); puntos.Size = new Size(100, 50); puntos.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold)); //Reloxxxx this.horaInicio = DateTime.Now; this.tiempoRestante = new TgcText2d(); this.tiempoRestante.Text = "65"; this.tiempoRestante.Color = Color.Green; this.tiempoRestante.Align = TgcText2d.TextAlign.RIGHT; this.tiempoRestante.Position = new Point(300, 30); this.tiempoRestante.Size = new Size(100, 50); this.tiempoRestante.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold)); this.comienzoNivel = true; //FLECHA NORMAL colision collisionNormalArrow = new TgcArrow(); collisionNormalArrow.BodyColor = Color.Blue; collisionNormalArrow.HeadColor = Color.Yellow; collisionNormalArrow.Thickness = 1.4f; collisionNormalArrow.HeadSize = new Vector2(10, 20); //FLECHA debug (la usamos para conocer posiciones donde querramos posicionar meshes) debugArrow = new TgcArrow(); debugArrow.BodyColor = Color.Purple; debugArrow.HeadColor = Color.Yellow; debugArrow.Thickness = 3f; debugArrow.HeadSize = new Vector2(10, 20); debugArrow.PStart = new Vector3(0, 400f, 0); debugArrow.PEnd = new Vector3(0, 10f, 0); debugArrow.updateValues(); //USER VARS GuiController.Instance.UserVars.addVar("DistMinima"); GuiController.Instance.UserVars.addVar("Velocidad"); GuiController.Instance.UserVars.addVar("Vida"); GuiController.Instance.UserVars.addVar("AngCol"); GuiController.Instance.UserVars.addVar("AngRot"); GuiController.Instance.UserVars.addVar("NormalObstaculoX"); GuiController.Instance.UserVars.addVar("NormalObstaculoZ"); }
private void crearNivel1( ) { //Construcción del escenario del nivel 1 int cantVueltas = 1; //este nivel va tener una vuelta para que se pueda ganar TgcBox piso; // ----- PÉRGOLA ----- // TgcSimpleTerrain terrain; string currentHeightmap; string currentTexture; float currentScaleXZ; float currentScaleY; //Path de Heightmap default del terreno y Modifier para cambiarla currentHeightmap = Shared.mediaPath + "\\otros\\heighmap.jpg"; currentScaleXZ = 12f; currentScaleY = 2.2f; currentTexture = Shared.mediaPath + "\\otros\\block02.png"; //Cargar terreno: cargar heightmap y textura de color terrain = new TgcSimpleTerrain(); terrain.loadHeightmap(currentHeightmap, currentScaleXZ, currentScaleY, new Vector3(0, 0, -300)); terrain.loadTexture(currentTexture); //elementos.Add(hongo); List <TgcScene> arboles = EjemploAlumno.getInstance().getArboles(); float separacionEntreArboles = 0f; float inclinacionFila = 0f; foreach (TgcScene escenaArbol in arboles) { TgcMesh arbol = escenaArbol.Meshes[0]; arbol.Position = new Vector3(600 + separacionEntreArboles, 0, 2400 + inclinacionFila); arbol.Scale = new Vector3(23f, 23f, 23f); elementos.Add(arbol); separacionEntreArboles += 500f; inclinacionFila += 60f; } TgcTexture textura = TgcTexture.createTexture(GuiController.Instance.D3dDevice, GuiController.Instance.AlumnoEjemplosMediaDir + "LosBorbotones\\escenario\\pista3.jpg"); piso = TgcBox.fromSize(new Vector3(0, 0, 0), new Vector3(15000, 0, 10000), textura); //es un cubo plano con una textura (foto de la pista) cielo = new TgcSkyBox(); //Se crea el cielo, es como un cubo grande que envuelve todo y sirve de límite cielo.Center = new Vector3(0, 0, 0); cielo.Size = new Vector3(20000, 9000, 18000); cielo.setFaceTexture(TgcSkyBox.SkyFaces.Up, Shared.mediaPath + "\\escenario\\cielo.jpg"); cielo.setFaceTexture(TgcSkyBox.SkyFaces.Down, Shared.mediaPath + "\\escenario\\cielo.jpg"); cielo.setFaceTexture(TgcSkyBox.SkyFaces.Left, Shared.mediaPath + "\\escenario\\cielo.jpg"); cielo.setFaceTexture(TgcSkyBox.SkyFaces.Right, Shared.mediaPath + "\\escenario\\cielo.jpg"); cielo.setFaceTexture(TgcSkyBox.SkyFaces.Front, Shared.mediaPath + "\\escenario\\cielo.jpg"); cielo.setFaceTexture(TgcSkyBox.SkyFaces.Back, Shared.mediaPath + "\\escenario\\cielo.jpg"); cielo.updateValues(); cajas.Add(piso); //CARGAR OBSTÁCULOS obstaculos.Add(new ObstaculoRigido(-100, 0, -1800, 3700, 300, 80, Shared.mediaPath + "\\otros\\block01.jpg")); obstaculos.Add(new ObstaculoRigido(-1300, 0, -100, 80, 300, 3200, Shared.mediaPath + "\\otros\\block01.jpg")); obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\columna\\columna-TgcScene.xml", new Vector3(5650, 0, -3000), new Vector3(15f, 15f, 15f))); obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\columna\\columna-TgcScene.xml", new Vector3(5500, 0, -3250), new Vector3(10f, 10f, 10f))); obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\columna\\columna-TgcScene.xml", new Vector3(5850, 0, -3000), new Vector3(5f, 5f, 5f))); obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\carnivora\\carnivora-TgcScene.xml", new Vector3(2000, 0, 0), new Vector3(7f, 7f, 7f))); ObstaculoRigido p = new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\carnivora\\carnivora-TgcScene.xml", new Vector3(2200, 0, 100), new Vector3(5f, 5f, 5f)); p.mesh.rotateY(0.5f); obstaculos.Add(p); //guardabarros obstaculos.Add(new ObstaculoRigido(7625, -400, 0, 250, 1100, 10000, Shared.mediaPath + "\\otros\\block01.jpg")); obstaculos.Add(new ObstaculoRigido(-7625, -400, 0, 250, 1100, 10000, Shared.mediaPath + "\\otros\\block01.jpg")); obstaculos.Add(new ObstaculoRigido(0, -400, 5125, 15000, 1100, 250, Shared.mediaPath + "\\otros\\block01.jpg")); obstaculos.Add(new ObstaculoRigido(0, -400, -5125, 15000, 1100, 250, Shared.mediaPath + "\\otros\\block01.jpg")); //Checkpoints for (int m = 0; m < cantVueltas; m++) { this.PosicionesCheckpoints.Add(new Vector3(5300, -4000, 0)); this.PosicionesCheckpoints.Add(new Vector3(0, 0, 0)); this.PosicionesCheckpoints.Add(new Vector3(6000, 2500, 0)); this.PosicionesCheckpoints.Add(new Vector3(-5000, 4500, 0)); this.PosicionesCheckpoints.Add(new Vector3(-5000, 1750, 0)); this.PosicionesCheckpoints.Add(new Vector3(-2500, -500, 0)); this.PosicionesCheckpoints.Add(new Vector3(-5500, -2500, 0)); this.PosicionesCheckpoints.Add(new Vector3(-5000, -4500, 0)); this.PosicionesCheckpoints.Add(new Vector3(0, -2500, 0)); } this.agregarCheckpoints(); checkpointActual = checkpoints.ElementAt(0); checkpointsRestantes = new TgcText2d(); checkpointsRestantes.Text = checkpoints.Count().ToString(); checkpointsRestantes.Color = Color.DarkRed; checkpointsRestantes.Align = TgcText2d.TextAlign.RIGHT; checkpointsRestantes.Position = new Point(630, 30); checkpointsRestantes.Size = new Size(100, 50); checkpointsRestantes.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold)); ObstaculoRigido hV = new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoVerde\\HongoVerde-TgcScene.xml", new Vector3(-4300, 0, -300), new Vector3(2f, 2f, 2f)); hV.mesh.rotateY(0.2f); obstaculos.Add(hV); obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoRojo\\HongoRojo-TgcScene.xml", new Vector3(-4200, 0, -300), new Vector3(0.5f, 0.5f, 0.5f))); obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoRojo\\HongoRojo-TgcScene.xml", new Vector3(-4300, 0, -400), new Vector3(1.2f, 1.2f, 1.2f))); obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoRojo\\HongoRojo-TgcScene.xml", new Vector3(-5000, 0, 3000), new Vector3(2f, 2f, 2f))); obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoVerde\\HongoVerde-TgcScene.xml", new Vector3(-5100, 0, 3000), new Vector3(0.5f, 0.5f, 0.5f))); obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoVerde\\HongoVerde-TgcScene.xml", new Vector3(-5100, 0, 3000), new Vector3(1.5f, 1.5f, 1.5f))); obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoVerde\\HongoVerde-TgcScene.xml", new Vector3(-4900, 0, 3100), new Vector3(0.2f, 0.2f, 0.2f))); ObstaculoRigido b = new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\bar\\bar-TgcScene.xml", new Vector3(2300, 0, 2600), new Vector3(67f, 15f, 20f)); obstaculos.Add(b); foreach (ObstaculoRigido obstaculo in obstaculos) { objetos.Add(obstaculo.mesh); } foreach (TgcMesh elemento in elementos) { objetos.Add(elemento); } foreach (Recursos recurso in recursos) { objetos.Add(recurso.modelo); } //Crear grilla quadtree = new Quadtree(); quadtree.create(objetos, escenarioBB); quadtree.createDebugQuadtreeMeshes(); GuiController.Instance.Modifiers.addBoolean("showQuadtree", "Show Quadtree", false); terrenos.Add(terrain); }
public void render(float elapsedTime) { TgcD3dInput d3dInput = GuiController.Instance.D3dInput; //Calcular proxima posicion de personaje segun Input float moveForward = 0f; float moveSide = 0f; float rotateY = 0; float rotateX = 0; float jump = 0; bool moving = false; bool rotating = false; bool rotatingY = false; bool rotatingX = false; bool running = false; bool jumping = false; string animationAction = "StandBy"; TgcSprite mira; //Crear Sprite de mira mira = new TgcSprite(); mira.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "\\Kamikaze3D\\mira.png"); //Ubicarlo centrado en la pantalla Size screenSize = GuiController.Instance.Panel3d.Size; Size textureSize = mira.Texture.Size; mira.Position = new Vector2(screenSize.Width / 2 - textureSize.Width / 2, screenSize.Height / 2 - textureSize.Height / 2); TgcText2d hitCantTextY = new TgcText2d(); hitCantTextY.Position = new Point(0, 0); hitCantTextY.Color = Color.White; TgcText2d hitCantTextX = new TgcText2d(); hitCantTextX.Position = new Point(0, 20); hitCantTextX.Color = Color.White; //obtener velocidades de Modifiers (no deberia estar porque es fijo) float velocidadCaminar = (float)GuiController.Instance.Modifiers.getValue("VelocidadCaminar"); //float velocidadMoveSide = (float)GuiController.Instance.Modifiers.getValue("velocidadMoveSide"); float velocidadRotacion = (float)GuiController.Instance.Modifiers.getValue("VelocidadRotacion"); //Obtener boolean para saber si hay que mostrar Bounding Box (tampoco deberia estar) bool showBB = (bool)GuiController.Instance.Modifiers.getValue("showBoundingBox"); //Adelante if (d3dInput.keyDown(Key.W)) { moveForward = -velocidadCaminar; moving = true; } //Atras if (d3dInput.keyDown(Key.S)) { moveForward = velocidadCaminar; moving = true; } //Derecha if (d3dInput.buttonDown(TgcD3dInput.MouseButtons.BUTTON_LEFT) && d3dInput.XposRelative > 0) { if (camara.RotationY < (Math.PI)) { rotateY = velocidadRotacion; rotating = true; rotatingY = true; } } //Mover Derecha if (d3dInput.keyDown(Key.D)) { moveSide = -velocidadCaminar; moving = true; } //Izquierda if (d3dInput.buttonDown(TgcD3dInput.MouseButtons.BUTTON_LEFT) && d3dInput.XposRelative < 0) { if (camara.RotationY > -(Math.PI)) { rotateY = -velocidadRotacion; rotating = true; rotatingY = true; } } //Mover Izquierda if (d3dInput.keyDown(Key.A)) { moveSide = velocidadCaminar; moving = true; } //Arriba if (d3dInput.buttonDown(TgcD3dInput.MouseButtons.BUTTON_LEFT) && d3dInput.YposRelative < 0) { if (camara.RotationX > -(Math.PI / 3)) { rotateX = -velocidadRotacion; rotating = true; rotatingX = true; } } //Abajo if (d3dInput.buttonDown(TgcD3dInput.MouseButtons.BUTTON_LEFT) && d3dInput.YposRelative > 0) { if (camara.RotationX < (Math.PI / 3)) { rotateX = velocidadRotacion; rotating = true; rotatingX = true; } } //Jump /* if (d3dInput.keyDown(Key.Space)) * { * jump = 30; * moving = true; * }*/ //Run if (d3dInput.keyDown(Key.LeftShift)) { running = true; moveForward *= 1.5f; } if (d3dInput.keyDown(Key.E)) { animationAction = "WeaponPos"; } //Si hubo rotacion if (rotating) { if (rotatingY) { //Rotar personaje y la camara, hay que multiplicarlo por el tiempo transcurrido para no atarse a la velocidad el hardware float rotAngleY = Geometry.DegreeToRadian(rotateY * elapsedTime); personaje.rotateY(rotAngleY); camara.rotateY(rotAngleY); } if (rotatingX) { //Rotar personaje y la camara, hay que multiplicarlo por el tiempo transcurrido para no atarse a la velocidad el hardware float rotAngleX = Geometry.DegreeToRadian(rotateX * elapsedTime); camara.rotateX(rotAngleX); } } //Si hubo desplazamiento if (moving) { //Activar animacion de caminando if (running) { personaje.playAnimation("Run", true); } else if (jumping) { personaje.playAnimation("Jump", true); } else { personaje.playAnimation("Walk", true); } } //Si no se esta moviendo, activar animationAction else { personaje.playAnimation(animationAction, true); } //Vector de movimiento Vector3 movementVector = Vector3.Empty; if (moving) { //Aplicar movimiento, desplazarse en base a la rotacion actual del personaje //Grupo Kamikaze3D :: Se agrega también al desplazamiento sobre el eje x y eje z, el valor de desplazamiento lateral movementVector = new Vector3( (FastMath.Sin(personaje.Rotation.Y) * moveForward) + (FastMath.Cos(personaje.Rotation.Y) * moveSide), jump, (FastMath.Cos(personaje.Rotation.Y) * moveForward) + (-FastMath.Sin(personaje.Rotation.Y) * moveSide) ); } //Actualizar valores de gravedad collisionManager.GravityEnabled = (bool)GuiController.Instance.Modifiers["HabilitarGravedad"]; collisionManager.GravityForce = (Vector3)GuiController.Instance.Modifiers["Gravedad"]; collisionManager.SlideFactor = (float)GuiController.Instance.Modifiers["SlideFactor"]; //Mover personaje con detección de colisiones, sliding y gravedad Vector3 realMovement = collisionManager.moveCharacter(characterSphere, movementVector, objetosColisionables); personaje.move(realMovement); //Actualizar valores de la linea de movimiento directionArrow.PStart = characterSphere.Center; directionArrow.PEnd = characterSphere.Center + Vector3.Multiply(movementVector, 50); directionArrow.updateValues(); //Cargar desplazamiento realizar en UserVar GuiController.Instance.UserVars.setValue("Movement", TgcParserUtils.printVector3(realMovement)); //Render linea if (renderDirectionArrow) { directionArrow.render(); } //Render personaje personaje.animateAndRender(); /* //Iniciar dibujado de todos los Sprites de la escena (en este caso es solo uno) * GuiController.Instance.Drawer2D.beginDrawSprite(); * * //Dibujar sprite (si hubiese mas, deberian ir todos aquí) * mira.render(); * * //Finalizar el dibujado de Sprites * GuiController.Instance.Drawer2D.endDrawSprite();*/ hitCantTextY.Text = "Y: " + camara.RotationY; hitCantTextX.Text = "X: " + camara.RotationX; hitCantTextY.render(); hitCantTextX.render(); if (showBB) { characterSphere.render(); } }