예제 #1
0
        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;
        }
예제 #2
0
        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);
        }
예제 #3
0
        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;
        }
예제 #4
0
        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();
        }
예제 #5
0
        private ContadorBalas()
        {
            Size screenSize = GuiController.Instance.Panel3d.Size;
            juego = Juego.Instance;

            indicadorBala = new Indicadores();
            indicadorCargador = new Indicadores();

            texto = new TgcText2d();
            texto.Color = Color.Red;
            texto.Align = TgcText2d.TextAlign.LEFT;

            int tamañoTexturaBala = (int)indicadorBala.getPosicionXSpriteBala();
            texto.Position = new Point(tamañoTexturaBala + 25, screenSize.Height - 32);
            texto.Size = new Size(350, 500);
            texto.changeFont(new System.Drawing.Font("Arial", 16f, FontStyle.Bold));

            textoCargador = new TgcText2d();
            textoCargador.Color = Color.Red;
            textoCargador.Align = TgcText2d.TextAlign.LEFT;

            int tamañoTexturaCargador = (int)indicadorBala.getPosicionXSpriteCargador();
            textoCargador.Position = new Point(tamañoTexturaCargador + 190, screenSize.Height - 32);
            textoCargador.Size = new Size(350, 100);
            textoCargador.changeFont(new System.Drawing.Font("Arial", 16f, FontStyle.Bold));

            setInitialValues();
        }
예제 #6
0
 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);
 }
예제 #7
0
        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 TextControlPanel()
        {
            this.active = false;
            this.bindedCommands = new List<BindedCommand>();

            this.text = new TgcText2d();
            this.text.Align = TgcText2d.TextAlign.LEFT;
            this.text.Position = new Point(2, 100);
            this.text.Size = new Size(300, 300);
            this.text.Color = Color.LightPink;
            this.text.Text = "Panel de control\n(no gráfico por el momento :p)\nOpciones >>\n\n";
        }
예제 #9
0
        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();
        }
예제 #10
0
        public Tiempo()
        {
            Tiempo.Instance = this;

            _timer = new Timer();
            texto = new TgcText2d();
            texto.Color = Color.Red;
            texto.Align = TgcText2d.TextAlign.LEFT;
            texto.Position = new Point(5, 55);
            texto.Size = new Size(350, 100);
            texto.changeFont(new System.Drawing.Font("Arial", 16f, FontStyle.Bold));
            texto.Text = "Tiempo restante: ";
        }
예제 #11
0
        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);
        }
예제 #12
0
        public void initialize()
        {
            sonido = SoundManager.getInstance();

            textoVida = new TgcText2d();
            textoVida.Color = Color.Red;
            textoVida.Align = TgcText2d.TextAlign.LEFT;
            int tamañoTexturaX = (int) new Indicadores().getPosicionXSpriteVida();
            textoVida.Position = new Point(tamañoTexturaX + 35, 25);
            textoVida.Size = new Size(350, 100);
            textoVida.changeFont(new System.Drawing.Font("Arial", 16f, FontStyle.Bold));

            setInitialValues();
        }
예제 #13
0
        public ContadorEnemigos()
        {
            ContadorEnemigos.Instance = this;

            Size screenSize = GuiController.Instance.Panel3d.Size;

            texto = new TgcText2d();
            texto.Color = Color.Red;
            texto.Align = TgcText2d.TextAlign.LEFT;
            int tamañoTexturaX = (int)new Indicadores().getPosicionXSpriteEnemigo();
            texto.Position = new Point(screenSize.Width - 105 + tamañoTexturaX, 35);
            texto.Size = new Size(350, 100);
            texto.changeFont(new System.Drawing.Font("Arial", 16f, FontStyle.Bold));

            setInitialValues();
        }
예제 #14
0
        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;
        }
예제 #15
0
        public GameOver()
        {
            indacadorGameOver = new Indicadores();

            textoFin = new TgcText2d();
            textoFin.Color = Color.Black;
            textoFin.Align = TgcText2d.TextAlign.CENTER;
            textoFin.Position = new Point(0, 0);
            textoFin.Size = new Size(650, 300);
            textoFin.changeFont(new System.Drawing.Font("Arial", 16f, FontStyle.Bold));
            textoFin.Text = "GAME OVER!!";

            //cargo el sprite del gameover

            spriteGameOver = new TgcSprite();
            spriteGameOver.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "\\RenderMan\\sprites\\Game-Over.png");
            Size textureSize = spriteGameOver.Texture.Size;
            spriteGameOver.Scaling = new Vector2(indacadorGameOver.ajustarTexturaAPantalla(screenSize.Width, textureSize.Width),indacadorGameOver.ajustarTexturaAPantalla(screenSize.Height, textureSize.Height));
            spriteGameOver.Position = new Vector2(0, 0);
            //sonido.playSonidoFin();
        }
예제 #16
0
        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");
        }
예제 #17
0
        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();
        }
예제 #18
0
        public Game()
        {
            Fuentes.cargarFuentes();

            //sprites
            if (!inicializo)
            {
                mapita = new TgcSprite();
                mapita.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "\\sprites\\preview.png");
                motoSprite = new TgcSprite();
                motoSprite.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "\\sprites\\dirtbike.png");
                timer = new TgcSprite();
                timer.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "\\sprites\\gate.png");

                //Ubicarlo centrado en la pantalla
                screenSize = GuiController.Instance.Panel3d.Size;
                textureSize = mapita.Texture.Size;
                motoTextureSize = motoSprite.Texture.Size;
                mapita.Scaling = (new Vector2(0.7f, 0.7f));
                motoSprite.Scaling = (new Vector2(0.5f, 0.5f));

                mapita.Position = new Vector2(FastMath.Max(screenSize.Width / 2 - textureSize.Width * 0.7f / 2, 0), 16);

                motoSprite.Position = new Vector2(FastMath.Max(screenSize.Width / 2 - motoTextureSize.Width * 0.5f / 2 - textureSize.Width * 0.7f / 2, 0), 8);

                timer.Position = new Vector2(screenSize.Width - 250, screenSize.Height - 125);

                timer.Scaling = new Vector2(0.9f, 0.8f);
                posMotoInicial = motoSprite.Position;
                inicializo = true;
            }
            d3dDevice = GuiController.Instance.D3dDevice;

            d3dDevice.Transform.Projection =
                Matrix.PerspectiveFovLH(Geometry.DegreeToRadian(45.0f),
                TgcD3dDevice.aspectRatio, 1f, 5000000f);

            string texturesPath = GuiController.Instance.AlumnoEjemplosMediaDir + "skybox\\";
            TgcSceneLoader loader = new TgcSceneLoader();
            collisionManager = new ElipsoidCollisionManager();
            collisionManager.GravityEnabled = false;
            tiempoAcelerando = 0f;
            tiempoDescelerando = 0f;
            velIni = 0f;
            tocandoPiso = false;
            saltando = true;
            ultimoMov = new Vector3(0, 0, 0);

            //skybox
            inicializarSkybox(texturesPath);

            //checkpoints
            int posCP = -150;
            foreach (TgcBoundingBox bb in checkpoints)
            {
                bb.setExtremes(new Vector3(-200, -100, posCP), new Vector3(200, 1000, posCP - 10));
                posCP -= 1300;
            }

            //carga la ciudad
            scene = loader.loadSceneFromFile(GuiController.Instance.AlumnoEjemplosMediaDir + "pistaDesierto\\pistaDesierto2-TgcScene.xml");

            //cargo la moto
            motorcycle = loader.loadSceneFromFile(GuiController.Instance.AlumnoEjemplosMediaDir + "moto\\Moto2-TgcScene.xml").Meshes[0];
            motorcycle.move(-40, 100, -150);

            //cargo la piramide
            piramid = loader.loadSceneFromFile(GuiController.Instance.AlumnoEjemplosMediaDir + "piramide\\piramide-TgcScene.xml").Meshes[0];
            piramid.Scale = new Vector3(5, 5, 5);
            piramid.move(-265, -45, -13750);

            //cargo texto ganaste

            textGanaste = new TgcText2d();
            textGanaste2 = new TgcText2d();

            //Cargar Textos
            textGanaste.Text = "FELICIDADES, HAS GANADO";
            textGanaste2.Text = "APRETE Q PARA VOLVER AL MENU";
            textGanaste.Position = new Point(0, 50);
            textGanaste2.Position = new Point(0, 100);
            textGanaste.changeFont(new System.Drawing.Font("TimesNewRoman", 23, FontStyle.Bold | FontStyle.Bold));
            textGanaste2.changeFont(new System.Drawing.Font("TimesNewRoman", 23, FontStyle.Bold | FontStyle.Bold));

            textGanaste.Color = Color.White;
            textGanaste2.Color = Color.White;

            // Creo texto contador de tiempo
            textoContadorTiempo = new TgcText2d();
            textoContadorTiempo.Color = Color.Black;
            textoContadorTiempo.Align = TgcText2d.TextAlign.RIGHT;
            textoContadorTiempo.Position = new Point(630, 400); //(680, 400)
            textoContadorTiempo.Size = new Size(300, 100);
            textoContadorTiempo.changeFont(new System.Drawing.Font(Fuentes.fuente.Families[0], 25, FontStyle.Regular));

            // Creo texto mejor tiempo
            textoMejorTiempo = new TgcText2d();
            textoMejorTiempo.Color = Color.Black;
            textoMejorTiempo.Align = TgcText2d.TextAlign.RIGHT;
            textoMejorTiempo.Position = new Point(630, 430);  //(680, 430)
            textoMejorTiempo.Size = new Size(300, 100);
            textoMejorTiempo.changeFont(new System.Drawing.Font(Fuentes.fuente.Families[0], 25, FontStyle.Regular));

            //Texto para mostrar fps
            textFPS = new TgcText2d();
            textFPS.Position = new Point((screenSize.Width / (-2)), 0);
            textFPS.Text = "FPS: ";
            textFPS.Color = Color.Yellow;

            //camara
            GuiController.Instance.ThirdPersonCamera.Enable = true;
            GuiController.Instance.ThirdPersonCamera.setCamera(motorcycle.Position + new Vector3(0,0,-100), 10, 200);
            GuiController.Instance.ThirdPersonCamera.rotateY(-0.7f);

            //creo la bounding elipsoid

            motorcycle.Scale = new Vector3(0.5f, 0.5f, 0.5f);

            // motorcycle.AutoUpdateBoundingBox = false;
            characterElipsoid = new TgcElipsoid(motorcycle.BoundingBox.calculateBoxCenter() + new Vector3(0, 0, 0), new Vector3(23, 23, 23) * 0.5f);

            //cargo los colliders
            objetosColisionables.Clear();
            foreach (TgcMesh mesh in scene.Meshes)
            {
                //Los objetos del layer "TriangleCollision" son colisiones a nivel de triangulo
                if (mesh.Layer == "TriangleCollision")
                {
                    objetosColisionables.Add(TriangleMeshCollider.fromMesh(mesh));

                }
                //El resto de los objetos son colisiones de BoundingBox. Las colisiones a nivel de triangulo son muy costosas asi que deben utilizarse solo
                //donde es extremadamente necesario (por ejemplo en el piso). El resto se simplifica con un BoundingBox
                else
                {
                    objetosColisionables.Add(BoundingBoxCollider.fromBoundingBox(mesh.BoundingBox));
                }
            }

            //agrego Piramide Como objeto Colisionable
            objetosColisionables.Add(BoundingBoxCollider.fromBoundingBox(piramid.BoundingBox));

            //Cargo lineaInicio

            lineaInicio = new TgcBox();
            lineaInicio.Position = new Vector3(-7, 30, -50);
            lineaInicio.Size = new Vector3(200, 2000, 1);
            lineaInicio.updateValues();

            //Cargo lineaFin
            lineaFin = new TgcBox();
            lineaFin.Size = new Vector3(100, 1000, 1);
            lineaFin.Position = new Vector3(0, 15, -13250);
            lineaFin.Color = Color.White;
            lineaFin.updateValues();

            //La agrego como objeto colisionable
            objetosColisionables.Add(BoundingBoxCollider.fromBoundingBox(lineaInicio.BoundingBox));

            showBB = false;

            //iluminacion
            ojalaQueAnde = new ShadowMap(scene, motorcycle);

            //DEBUG
            //Crear linea para mostrar la direccion del movimiento del personaje
            directionArrow = new TgcArrow();
            directionArrow.BodyColor = Color.Red;
            directionArrow.HeadColor = Color.Green;
            directionArrow.Thickness = 0.4f;
            directionArrow.HeadSize = new Vector2(5, 10);

            //Linea para normal de colision
            collisionNormalArrow = new TgcArrow();
            collisionNormalArrow.BodyColor = Color.Blue;
            collisionNormalArrow.HeadColor = Color.Yellow;
            collisionNormalArrow.Thickness = 0.4f;
            collisionNormalArrow.HeadSize = new Vector2(2, 5);

            //Caja para marcar punto de colision
            collisionPoint = TgcBox.fromSize(new Vector3(4, 4, 4), Color.Red);
            //TERMINA DEBUG
        }
예제 #19
0
        public void Init()
        {
            GAME_OVER = false;
            TEXT_DELAY = 0;
            time = 0;
            ScreenWidth = GuiController.Instance.D3dDevice.Viewport.Width;
            ScreenHeight = GuiController.Instance.D3dDevice.Viewport.Height;
            d3dDevice = GuiController.Instance.D3dDevice;

            //-------------User Interface------------
            //Textos para los Kills
            specialKillText = new TgcText2d();
            specialKillText.Color = Color.Crimson;
            specialKillText.Align = TgcText2d.TextAlign.CENTER;
            specialKillText.Position = new Point(0, 100);
            specialKillText.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold));

            //texto para el score
            //cambia de color segun el score
            scoreText = new TgcText2d();
            scoreText.Text = GameManager.Instance.score.ToString();
            scoreText.Color = Color.LightBlue;
            scoreText.changeFont(new System.Drawing.Font("Arial", 20, FontStyle.Bold));

            //texto para el capturas
            captureText = new TgcText2d();
            captureText.Text = GameManager.Instance.capturas.ToString() + "/11";
            captureText.Color = Color.FloralWhite;
            captureText.Position = new Point(450,0);
            captureText.changeFont(new System.Drawing.Font("Arial", 20, FontStyle.Bold));

            // cargamos los sprites
            screenCovered = SMALL_SCOPE;
            cross = new TgcSprite();
            normalScope = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Sprites\\normalScope.png");
            zoomedScope = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Sprites\\zoomedScope.png");
            cross.Texture = normalScope;

            refreshScopeTexture();

            HudFront = new TgcSprite();
            HudFront.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Sprites\\HudFront.png");

            initHudFront();

            healthSprite = new TgcSprite();
            healthSprite.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Sprites\\HealthStencil.png");

            healthInit();

            hudWeapon = new TgcSprite();
            sniperTexture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Sprites\\sniperHUD.png");
            launcherTexture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Sprites\\launcherHUD.png");
            refreshMainWeapon();
            hudWeaponInit();

            scoreSprite = new TgcSprite();
            scoreSprite.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Sprites\\Score.png");

            initScoreSprite();

            mapBaseSprite = new TgcSprite();

            mapBaseSprite.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Sprites\\MapBase.png");

            initMapBase();

            playerPointerSprite = new TgcSprite();
            playerPointerSprite.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Sprites\\playerPointer.png");

            initPlayerPointer();

            highScoreSprite = new TgcSprite();
            highScoreSprite.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Sprites\\highScore.png");

            initHighScore();

            //inicializo audio
            sound = new TgcStaticSound();
            ambient = new TgcStaticSound();
            string dir = GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Audio/Ambiente/Deep_space.wav";
            ambient.loadSound(dir, -1500);
            ambient.play(true);

            reachedHighScore = false;
        }
예제 #20
0
 private void initScore()
 {
     Texto_Score = new TgcText2d();
     Texto_Score.Color = Color.LightGreen;
     Texto_Score.changeFont(new System.Drawing.Font("Cataclysmic", 25.0f));
     Texto_Score.Size = new Size(0, 0);
     Texto_Score.Position = new Point(anchoPantalla * 9 / 10, 0);
 }
예제 #21
0
        public MeshCreatorControl(TgcMeshCreator creator)
        {
            InitializeComponent();

            this.creator = creator;
            this.meshes = new List<EditorPrimitive>();
            this.selectionList = new List<EditorPrimitive>();
            this.pickingRay = new TgcPickingRay();
            this.grid = new Grid(this);
            this.selectionRectangle = new SelectionRectangle(this);
            creatingPrimitive = null;
            primitiveNameCounter = 0;
            currentGizmo = null;
            mediaPath = GuiController.Instance.ExamplesMediaDir + "MeshCreator\\";
            defaultTexturePath = mediaPath + "Textures\\Madera\\cajaMadera1.jpg";
            checkBoxShowObjectsBoundingBox.Checked = true;
            popupOpened = false;
            fpsCameraEnabled = false;
            lastSavePath = null;

            //meshBrowser
            //defaultMeshPath = mediaPath + "Meshes\\Vegetacion\\Arbusto\\Arbusto-TgcScene.xml";
            defaultMeshPath = mediaPath + "\\Meshes\\Vegetacion";
            meshBrowser = new TgcMeshBrowser();
            meshBrowser.setSelectedMesh(defaultMeshPath);

            //Export scene dialog
            exportSceneSaveDialog = new SaveFileDialog();
            exportSceneSaveDialog.DefaultExt = ".xml";
            exportSceneSaveDialog.Filter = ".XML |*.xml";
            exportSceneSaveDialog.AddExtension = true;
            exportSceneSaveDialog.Title = "Export scene to a -TgcScene.xml file";

            //Camara
            camera = new MeshCreatorCamera();
            camera.Enable = true;
            camera.setCamera(new Vector3(0, 0, 0), 500);
            camera.BaseRotX = -FastMath.PI / 4f;
            GuiController.Instance.CurrentCamera.Enable = false;

            //Gizmos
            translateGizmo = new TranslateGizmo(this);
            scaleGizmo = new ScaleGizmo(this);

            //Tab inicial
            tabControl.SelectedTab = tabControl.TabPages["tabPageCreate"];
            currentState = State.SelectObject;
            radioButtonSelectObject.Checked = true;

            //Tab Create
            textBoxCreateCurrentLayer.Text = "Default";

            //Tab Modify
            textureBrowser = new TgcTextureBrowser();
            textureBrowser.ShowFolders = true;
            textureBrowser.setSelectedImage(defaultTexturePath);
            textureBrowser.AsyncModeEnable = true;
            textureBrowser.OnSelectImage += new TgcTextureBrowser.SelectImageHandler(textureBrowser_OnSelectImage);
            textureBrowser.OnClose += new TgcTextureBrowser.CloseHandler(textureBrowser_OnClose);
            pictureBoxModifyTexture.ImageLocation = defaultTexturePath;
            pictureBoxModifyTexture.Image = MeshCreatorUtils.getImage(defaultTexturePath);
            updateModifyPanel();

            //ObjectPosition Text
            objectPositionText = new TgcText2d();
            objectPositionText.Align = TgcText2d.TextAlign.LEFT;
            objectPositionText.Color = Color.Yellow;
            objectPositionText.Size = new Size(500, 12);
            objectPositionText.Position = new Point(GuiController.Instance.Panel3d.Width - objectPositionText.Size.Width, GuiController.Instance.Panel3d.Height - 20);

            //Snap to grid
            snapToGridCellSize = (float)numericUpDownCellSize.Value;

            //ObjectBrowser
            objectBrowser = new ObjectBrowser(this);

            //TextureBrowser para EditablePoly
            textureBrowserEPoly = new TgcTextureBrowser();
            textureBrowserEPoly.ShowFolders = true;
            textureBrowserEPoly.setSelectedImage(defaultTexturePath);
            textureBrowserEPoly.AsyncModeEnable = true;
            textureBrowserEPoly.OnSelectImage += new TgcTextureBrowser.SelectImageHandler(textureBrowserEPoly_OnSelectImage);
            textureBrowserEPoly.OnClose += new TgcTextureBrowser.CloseHandler(textureBrowserEPoly_OnClose);

            //Tooltips
            toolTips.SetToolTip(radioButtonSelectObject, "Select object (Q)");
            toolTips.SetToolTip(buttonSelectAll, "Select all objects (CTRL + E)");
            toolTips.SetToolTip(checkBoxShowObjectsBoundingBox, "Show objects BoundingBox");
            toolTips.SetToolTip(checkBoxSnapToGrid, "Toogle snap to grid");
            toolTips.SetToolTip(numericUpDownCellSize, "Snap to grid cell size");
            toolTips.SetToolTip(buttonZoomObject, "Zoom selected object (Z)");
            toolTips.SetToolTip(buttonHideSelected, "Hide selected objects (H)");
            toolTips.SetToolTip(buttonUnhideAll, "Unhide all hidden objects");
            toolTips.SetToolTip(buttonDeleteObject, "Delete selected objects (DEL)");
            toolTips.SetToolTip(buttonCloneObject, "Clone selected objects (CTRL + V)");
            toolTips.SetToolTip(radioButtonFPSCamera, "Toogle First-person camera (C)");
            toolTips.SetToolTip(numericUpDownFPSCameraSpeed, "First-person camera speed factor");
            toolTips.SetToolTip(buttonObjectBrowser, "Open Object Browser (O)");
            toolTips.SetToolTip(buttonTopView, "Set camera in Top-view (T)");
            toolTips.SetToolTip(buttonLeftView, "Set camera in Left-view (L)");
            toolTips.SetToolTip(buttonMergeSelected, "Merge selected objects (G)");
            toolTips.SetToolTip(buttonSaveScene, "Save scene in last used path (CTRL + S)");
            toolTips.SetToolTip(buttonSaveSceneAs, "Save scene in a new path (CTRL + SHIFT + S)");
            toolTips.SetToolTip(checkBoxAttachExport, "If selected all the scene is exported as one single mesh");
            toolTips.SetToolTip(buttonHelp, "Open Help (F1)");

            toolTips.SetToolTip(radioButtonPrimitive_Box, "Create a new Box (B)");
            toolTips.SetToolTip(radioButtonPrimitive_Sphere, "Create a new Sphere");
            toolTips.SetToolTip(radioButtonPrimitive_PlaneXZ, "Create a new XZ-plane (P)");
            toolTips.SetToolTip(radioButtonPrimitive_PlaneXY, "Create a new XY-plane");
            toolTips.SetToolTip(radioButtonPrimitive_PlaneYZ, "Create a new YZ-plane");
            toolTips.SetToolTip(buttonImportMesh, "Import an existing mesh (M)");
            toolTips.SetToolTip(textBoxCreateCurrentLayer, "Default layer for new created objects");

            toolTips.SetToolTip(buttonModifyConvertToMesh, "Conver to Mesh primitive");
            toolTips.SetToolTip(radioButtonModifySelectAndMove, "Move selected objects (W)");
            toolTips.SetToolTip(radioButtonModifySelectAndRotate, "Rotate selected objects (E)");
            toolTips.SetToolTip(radioButtonModifySelectAndScale, "Scale selected objects (R)");
            toolTips.SetToolTip(pictureBoxModifyTexture, "Change primitive texture");
            toolTips.SetToolTip(buttonModifyRecomputeAABB, "Compute a new BoundingBox for the primitive");

            toolTips.SetToolTip(radioButtonEPolyPrimitiveVertex, "Vertex primitve");
            toolTips.SetToolTip(radioButtonEPolyPrimitiveEdge, "Edge primitve");
            toolTips.SetToolTip(radioButtonEPolyPrimitivePolygon, "Polygon primitve");
            toolTips.SetToolTip(radioButtonEPolySelect, "Select primitive (Q)");
            toolTips.SetToolTip(buttonEPolySelectAll, "Select all primitives (CTRL + E)");
            toolTips.SetToolTip(radioButtonEPolyTranslate, "Move selected primitives (W)");
            toolTips.SetToolTip(buttonEPolyDelete, "Delete selected primitives (DEL)");
            toolTips.SetToolTip(buttonEPolyAddTexture, "Add new texture to mesh");
            toolTips.SetToolTip(buttonEPolyDeleteTexture, "Remove current texture");
            toolTips.SetToolTip(pictureBoxEPolyTexture, "Change current texture");
        }
예제 #22
0
        //Metodos para el menú y el marcador
        private void initMenu()
        {
            Imagen_Menu = new TgcSprite();
            Imagen_Menu.Texture =
            TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir +
                                     "Jet_Pilot\\Menu\\JP4.jpg");

            float factor_ancho = (float)anchoPantalla / (float)Imagen_Menu.Texture.Width;
            float factor_alto = (float)altoPantalla / (float)Imagen_Menu.Texture.Height;
            Imagen_Menu.Position = new Vector2(0, 0);
            Imagen_Menu.Scaling = new Vector2(factor_ancho, factor_alto);

            Texto_Start = new TgcText2d();
            Texto_Titulo = new TgcText2d();

            Texto_Start.Color = Color.Green;
            Texto_Titulo.Color = Color.LightGray;

            Texto_Start.Text = "Presione enter para iniciar";
            Texto_Titulo.Text = "JET PILOT";

            Texto_Start.changeFont(new System.Drawing.Font("Cataclysmic", 25.0f));
            Texto_Titulo.changeFont(new System.Drawing.Font("Chiller", 50.0f));

            Texto_Start.Size = new Size(0, 0);
            Texto_Titulo.Size = new Size(0, 0);

            Texto_Start.Position = new Point(anchoPantalla / 2 + Texto_Start.Text.Length / 2, altoPantalla * 9 / 10);
            Texto_Titulo.Position = new Point(anchoPantalla / 6, 0);

            sound = GuiController.Instance.Mp3Player;
            sound.FileName = GuiController.Instance.AlumnoEjemplosMediaDir +
            "Jet_Pilot\\Sonido\\102_prologue.mp3";
        }
예제 #23
0
        //Metodos para mostrar msjs por pantalla
        private void initMsjs()
        {
            Msj_Choque = new TgcText2d();
            Msj_Choque.Text = "Cuidado con el terreno!!";
            Msj_Choque.Position = new Point((int)player.GetPosition().X, altoPantalla / 3);
            Msj_Choque.Color = Color.DarkRed;
            Msj_Choque.changeFont(new System.Drawing.Font("Cataclysmic", 30.0f));

            Msj_Triunfo = new TgcText2d();
            Msj_Triunfo.Text = "Felicitaciones has capturado todas las calaveras!!";
            Msj_Triunfo.Position = new Point((int)player.GetPosition().X, altoPantalla / 3);
            Msj_Triunfo.Color = Color.DarkViolet;
            Msj_Triunfo.changeFont(new System.Drawing.Font("Cataclysmic", 30.0f));

            Msj_Advertencia = new TgcText2d();
            Msj_Advertencia.Text = "No vayas tan alto, tu techo de vuelo es de 20.000 m!";
            Msj_Advertencia.Position = new Point((int)player.GetPosition().X, altoPantalla / 3);
            Msj_Advertencia.Color = Color.DarkRed;
            Msj_Advertencia.changeFont(new System.Drawing.Font("Cataclysmic", 30.0f));
        }
예제 #24
0
        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");
        }
예제 #25
0
파일: Player.cs 프로젝트: javs/Snipers-CEGA
        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));
        }
예제 #26
0
        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);
        }
예제 #27
0
 private bool obtenerColisionConTexto(TgcText2d boton, Size tam)
 {
     Point mouse = Control.MousePosition;
     return mouse.X > boton.Position.X && mouse.X < (boton.Position.X + tam.Width*0.5f) && mouse.Y > boton.Position.Y && mouse.Y < (boton.Position.Y + tam.Height*0.5f);
 }
예제 #28
0
        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;
        }
예제 #29
0
        /// <summary>
        /// Método que se llama una sola vez,  al principio cuando se ejecuta el ejemplo.
        /// Escribir aquí todo el código de inicialización: cargar modelos, texturas, modifiers, uservars, etc.
        /// Borrar todo lo que no haga falta
        /// </summary>
        public override void init()
        {
            //GuiController.Instance: acceso principal a todas las herramientas del Framework

            //Device de DirectX para crear primitivas
            d3dDevice = GuiController.Instance.D3dDevice;

            rand = new Random();

            //Carpeta de archivos Media del alumno
            alumnoMediaFolder = GuiController.Instance.AlumnoEjemplosMediaDir;

            effect = TgcShaders.loadEffect(alumnoMediaFolder + "Shaders\\viento.fx");

            Control focusWindows = GuiController.Instance.D3dDevice.CreationParameters.FocusWindow;
            mouseCenter = focusWindows.PointToScreen(
                new Point(
                    focusWindows.Width / 2,
                    focusWindows.Height / 2)
                    );

            inicializarTerreno();

            pathMusica = GuiController.Instance.AlumnoEjemplosMediaDir + "Sonidos\\Stayin_alive.mp3";
            GuiController.Instance.Mp3Player.closeFile();
            GuiController.Instance.Mp3Player.FileName = pathMusica;

            player = GuiController.Instance.Mp3Player;

            //player.play(true);

            //Crear Sprite
            mira = new TgcSprite();
            mira.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\mira.png");
            miraActivada = false;
            mira_zoom = new TgcSprite();
            mira_zoom.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\mira_zoom3.png");

            arma = new TgcSprite();
            arma.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\arma.png");

            fuegoArma = new TgcAnimatedSprite(
                GuiController.Instance.ExamplesMediaDir + "\\Texturas\\Sprites\\Explosion.png", //Textura de 256x256
                new Size(64, 64), //Tamaño de un frame (64x64px en este caso)
                16, //Cantidad de frames, (son 16 de 64x64px)
                10 //Velocidad de animacion, en cuadros x segundo
                );

            //Sonidos
            disparo = new TgcStaticSound();
            disparo.loadSound(alumnoMediaFolder + "\\Sonidos\\disparo.wav");

            headshot = new TgcStaticSound();
            headshot.loadSound(alumnoMediaFolder + "\\Sonidos\\Headshot.wav");

            golpe = new TgcStaticSound();
            golpe.loadSound(alumnoMediaFolder + "\\Sonidos\\punch.wav");

            explosion = new TgcStaticSound();
            explosion.loadSound(alumnoMediaFolder + "\\Sonidos\\explosion.wav");

            muerte = new TgcStaticSound();
            muerte.loadSound(alumnoMediaFolder + "\\Sonidos\\gameover.wav");

            ganador = new TgcStaticSound();
            ganador.loadSound(alumnoMediaFolder + "\\Sonidos\\ganador.wav");

            sorpresa = new TgcStaticSound();
            sorpresa.loadSound(alumnoMediaFolder + "\\Sonidos\\sorpresa.wav");

            //Ubicarlo centrado en la pantalla
            screenSize = GuiController.Instance.Panel3d.Size;
            Size textureSize = mira.Texture.Size;
            mira.Scaling = new Vector2(0.6f, 0.6f);
            mira.Position = new Vector2(FastMath.Max(screenSize.Width / 2 - (textureSize.Width * 0.6f) / 2, 0), FastMath.Max(screenSize.Height / 2 - (textureSize.Height * 0.6f) / 2, 0));

            mira_zoom.Scaling = new Vector2((float)screenSize.Width / mira_zoom.Texture.Size.Width, (float)screenSize.Height / mira_zoom.Texture.Size.Height);
            mira_zoom.Position = new Vector2(0, 0);

            Size armaSize = arma.Texture.Size;
            float escalaAncho = (screenSize.Width / 2f) / armaSize.Width;

            arma.Scaling = new Vector2(escalaAncho, escalaAncho);
            arma.Position = new Vector2(screenSize.Width - (armaSize.Width * escalaAncho), screenSize.Height - (armaSize.Height * escalaAncho));

            posicionArmaDisparo = new Vector2(arma.Position.X + 5f, arma.Position.Y + 5f);
            posicionArmaOriginal = arma.Position;

            fuegoArma.Position = arma.Position + new Vector2(22f,28f);

            inicializarArboles();
            inicializarPasto();
            inicializarPiedras();

            totales = new List<TgcMesh>();
            totales.AddRange(arboles);
            totales.AddRange(pasto);
            totales.AddRange(piedras);

            qt = new Quadtree();
            qt.create(totales, bbSkyBox);
            qt.createDebugQuadtreeMeshes();

            //Crear texto vida, básico
            vida = new TgcText2d();
            vida.Text = "100";
            vida.Color = Color.White;
            vida.Size = new Size(300, 100);
            vida.changeFont(new System.Drawing.Font("BankGothic Md BT", 25, FontStyle.Bold));
            vida.Position = new Point(-60, 0);

            barraVida = new TgcSprite();
            barraVida.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\barra_vida.png");
            barraVida.Position = new Vector2((float)vida.Position.X + 175f, (float)vida.Position.Y);
            barraVida.Scaling = new Vector2(0.3f, 0.3f);

            textoPuntaje = new TgcText2d();
            textoPuntaje.Text = "Puntos: 0";
            textoPuntaje.Color = Color.White;
            textoPuntaje.Size = new Size(300, 100);
            textoPuntaje.changeFont(new System.Drawing.Font("BankGothic Md BT", 25, FontStyle.Bold));
            textoPuntaje.Position = new Point(screenSize.Width - 300, 0);

            TgcSceneLoader loaderLogo = new TgcSceneLoader();
            logoTgc = loaderLogo.loadSceneFromFile(GuiController.Instance.ExamplesMediaDir + "ModelosTgc\\LogoTGC\\LogoTGC-TgcScene.xml").Meshes[0];
            logoTgc.move(new Vector3(0f, 1900f, 0f));
            logoTgc.Scale = new Vector3(14f, 14f, 14f);

            //Cargar Shader de PhongShading
            logoTgc.Effect = GuiController.Instance.Shaders.TgcMeshPhongShader;
            logoTgc.Technique = GuiController.Instance.Shaders.getTgcMeshTechnique(logoTgc.RenderType);
            //Cargar variables shader
            logoTgc.Effect.SetValue("ambientColor", ColorValue.FromColor(Color.Gray));
            logoTgc.Effect.SetValue("diffuseColor", ColorValue.FromColor(Color.LightBlue));
            logoTgc.Effect.SetValue("specularColor", ColorValue.FromColor(Color.White));
            logoTgc.Effect.SetValue("specularExp", 20f);
            logoTgc.Effect.SetValue("lightPosition", lightPos);
            reproducirSorpresa = false;

            //////VARIABLES DE FRUSTUM

            aspectRatio = (float)GuiController.Instance.Panel3d.Width / GuiController.Instance.Panel3d.Height;

            ruedita = 0f;

            //Inicializo angulo de FOV
            anguloFov = FastMath.ToRad(45.0f);

            GuiController.Instance.D3dDevice.Transform.Projection = Matrix.PerspectiveFovLH(anguloFov, aspectRatio, 1f, 50000f);

            ///////////////USER VARS//////////////////
            /*
            //Crear una UserVar
            GuiController.Instance.UserVars.addVar("variablePrueba");

            //Cargar valor en UserVar
            GuiController.Instance.UserVars.setValue("variablePrueba", 5451);
            */

            ///////////////MODIFIERS//////////////////

               /*
            //Crear un modifier para un valor FLOAT
            GuiController.Instance.Modifiers.addFloat("valorFloat", -50f, 200f, 0f);

            //Crear un modifier para un ComboBox con opciones
            string[] opciones = new string[] { "opcion1", "opcion2", "opcion3" };
            GuiController.Instance.Modifiers.addInterval("valorIntervalo", opciones, 0);

            //Crear un modifier para modificar un vértice
            GuiController.Instance.Modifiers.addVertex3f("valorVertice", new Vector3(-100, -100, -100), new Vector3(50, 50, 50), new Vector3(0, 0, 0));
            */

            ///////////////CONFIGURAR CAMARA ROTACIONAL//////////////////
            //Es la camara que viene por default, asi que no hace falta hacerlo siempre
            //GuiController.Instance.RotCamera.Enable = true;
            //Configurar centro al que se mira y distancia desde la que se mira
            //GuiController.Instance.RotCamera.setCamera(new Vector3(0, 0, 0), 300);
            Vector3 posicion = new Vector3(0f, 150f, 0f);
            /*GuiController.Instance.FpsCamera.Enable = true;
            GuiController.Instance.FpsCamera.setCamera(new Vector3(0,120,0), new Vector3(1, 0, 1));
            //GuiController.Instance.FpsCamera.LookAt(new Vector3(0,120,0));
            GuiController.Instance.FpsCamera.JumpSpeed = 0;
            GuiController.Instance.FpsCamera.MovementSpeed *= 10;*/

            GuiController.Instance.FpsCamera.Enable = false;
            GuiController.Instance.RotCamera.Enable = false;

            camaraQ3 = new Q3FpsCamera();
            camaraQ3.setCamera(posicion, posicion + new Vector3(1.0f, 0.0f, 0.0f));
            camaraQ3.RotationSpeed = velocidadAngular;
            camaraQ3.MovementSpeed = velocidadMov;
            camaraQ3.LockCam = false;

            ultimaPosCamara = camaraQ3.getPosition();
            Vector3 posBound = new Vector3(camaraQ3.getPosition().X, camaraQ3.getPosition().Y + 30, camaraQ3.getPosition().Z);
            boundingCamara = new TgcBoundingBox();
            boundingCamScale = new Vector3(1f, 1f, 1f);
            boundingCamara.scaleTranslate(posBound, boundingCamScale);

            personaje = TgcBox.fromSize(new Vector3(30f, 60f, 30f), Color.Red);
            personaje.Position = camaraQ3.getPosition();
            personaje.move(new Vector3(0f, -30f, 0f));

            //ENEMIGOS
            instanciasEnemigos = new List<Enemigo>();
            //El ultimo parametro es el radio
            inicializarEnemigos(4, 4, instanciasEnemigos, 3.4f, 200.0f);

            crearEsferaExplosion();
            inicializarBarriles();

            //Para disparo
            col = new Vector3(0f, 0f, 0f);
            huboDisparo = false;
            disparoBarril = false;
            unaBala = new Bala();
            puntoDisparo = TgcBox.fromSize(new Vector3(10f, 10f, 10f), Color.Red);

            #region menu
            //Defino el estado inicial como menu
            estadoJuego = estado.menu;

            //Sprites para menu
            fondoMenu = new TgcSprite();
            fondoMenu.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\fondo_menu.jpg");

            titulo = new TgcSprite();
            titulo.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\titulo.png");
            titulo.Scaling = new Vector2(0.5f, 0.5f);
            titulo.Position = new Vector2((screenSize.Width / 2) - titulo.Texture.Width / 4, (titulo.Texture.Height / 2)-50f);

            instrucciones = new TgcSprite();
            instrucciones.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\instrucciones.png");
            instrucciones.Scaling = new Vector2(0.4f, 0.5f);
            instrucciones.Position = new Vector2((screenSize.Width / 2) - (instrucciones.Texture.Width*0.4f) / 2, (instrucciones.Texture.Height / 2) - instrucciones.Texture.Height / 2);

            creditos = new TgcSprite();
            creditos.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\creditos.png");
            creditos.Scaling = new Vector2(0.5f, 0.5f);
            creditos.Position = new Vector2((screenSize.Width / 2) - creditos.Texture.Width / 4, (creditos.Texture.Height / 2) - creditos.Texture.Height / 2);

            botonJugar = new TgcSprite();
            botonJugar.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\boton_jugar.png");
            botonJugar.Scaling = new Vector2(0.5f, 0.5f);
            sizeJugar = botonJugar.Texture.Size;
               // sizeJugar.Width = sizeJugar.Width / 2;
            botonJugar.Position = new Vector2((screenSize.Width / 2)-sizeJugar.Width/4, (screenSize.Height / 2)-sizeJugar.Height/4);

            botonInstrucciones = new TgcSprite();
            botonInstrucciones.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\boton_instrucciones.png");
            botonInstrucciones.Scaling = new Vector2(0.5f, 0.5f);
            sizeInstrucciones = botonInstrucciones.Texture.Size;
            //sizeInstrucciones.Width = sizeInstrucciones.Width / 2;
            botonInstrucciones.Position = new Vector2((screenSize.Width / 2) - sizeInstrucciones.Width / 4, (screenSize.Height / 2) - sizeInstrucciones.Height / 4 + 85f);

            botonCreditos = new TgcSprite();
            botonCreditos.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\boton_creditos.png");
            botonCreditos.Scaling = new Vector2(0.5f, 0.5f);
            sizeCreditos = botonCreditos.Texture.Size;
            //sizeCreditos.Width = sizeCreditos.Width / 2;
            botonCreditos.Position = new Vector2((screenSize.Width / 2) - sizeCreditos.Width / 4, (screenSize.Height / 2) - sizeCreditos.Height / 4 + sizeInstrucciones.Height + 50f);

            textoPerdiste = new TgcText2d();
            textoPerdiste.Text = "Game over";
            textoPerdiste.Align = TgcText2d.TextAlign.CENTER;
            textoPerdiste.Color = Color.Black;
            textoPerdiste.Size = new Size(600, 100);
            textoPerdiste.Position = new Point((screenSize.Width / 2) - textoPerdiste.Size.Width / 2, (screenSize.Height / 2) - textoPerdiste.Size.Height / 2);
            textoPerdiste.changeFont(new System.Drawing.Font("BankGothic Md BT", 50, FontStyle.Bold));

            textoGanaste = new TgcText2d();
            textoGanaste.Text = "Ganaste!";
            textoGanaste.Align = TgcText2d.TextAlign.CENTER;
            textoGanaste.Color = Color.Black;
            textoGanaste.Size = new Size(600, 100);
            textoGanaste.Position = new Point((screenSize.Width / 2) - textoGanaste.Size.Width / 2, (screenSize.Height / 2) - textoGanaste.Size.Height / 2);
            textoGanaste.changeFont(new System.Drawing.Font("BankGothic Md BT", 50, FontStyle.Bold));

            textoPuntajeFinal = new TgcText2d();
            textoPuntajeFinal.Color = Color.Black;
            textoPuntajeFinal.changeFont(new System.Drawing.Font("BankGothic Md BT", 25, FontStyle.Bold));
            textoPuntajeFinal.Size = new Size(800, 100);
            textoPuntajeFinal.Position = new Point((screenSize.Width / 2) - textoPuntajeFinal.Size.Width / 2, (screenSize.Height / 2) - textoPuntajeFinal.Size.Height/2 + textoGanaste.Size.Height);

            textoPuntajeRecord = new TgcText2d();
            textoPuntajeRecord.Color = Color.Black;
            textoPuntajeRecord.Size = new Size(400, 60);
            textoPuntajeRecord.changeFont(new System.Drawing.Font("BankGothic Md BT", 15, FontStyle.Bold));
            textoPuntajeRecord.Position = new Point((screenSize.Width - textoPuntajeRecord.Size.Width),(screenSize.Height-textoPuntajeRecord.Size.Height/2));
            puntajeRecord = Int32.Parse(System.IO.File.ReadAllText(alumnoMediaFolder + "\\record.txt"));
            textoPuntajeRecord.Text = "Tu puntaje record es: " + puntajeRecord.ToString();

            primeraVez = true;
            #endregion menu
        }
예제 #30
0
        public void activar(float elapsedTime,TgcText2d textGanaste, TgcText2d textGanaste2,TgcText2d textoContadorTiempo,TgcText2d textoMejorTiempo,TgcMesh piramid, TgcSkyBox skyBox, bool terminoJuego,TgcSprite tablero,TgcText2d textFPS)
        {
            Device device = GuiController.Instance.D3dDevice;
            Control panel3d = GuiController.Instance.Panel3d;
            float aspectRatio = (float)panel3d.Width / (float)panel3d.Height;
            time += elapsedTime;

            // animo la pos del avion
            if (!terminoJuego)
            {
                g_LightPos = motorcycle.Position + 2f*(new Vector3(100, 60, 0));
                g_LightDir = motorcycle.Position + (new Vector3(0, 0, 0)) - g_LightPos;
                g_LightDir.Normalize();
            }
            // Shadow maps:
            device.EndScene();      // termino el thread anterior

            GuiController.Instance.RotCamera.CameraCenter = new Vector3(0, 0, 0);
            GuiController.Instance.RotCamera.CameraDistance = 100;
            GuiController.Instance.RotCamera.RotationSpeed = 2f;
            GuiController.Instance.CurrentCamera.updateCamera();
            device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);

            //Genero el shadow map
            RenderShadowMap();

            device.BeginScene();
            // dibujo la escena pp dicha
            device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);
            RenderScene(false);
            if (terminoJuego)
            {
                textGanaste.render();
                textGanaste2.render();
            }

            GuiController.Instance.Drawer2D.beginDrawSprite();
            //Dibujar sprite (si hubiese mas, deberian ir todos aquí)
            tablero.render();
            //Finalizar el dibujado de Sprites
            GuiController.Instance.Drawer2D.endDrawSprite();

            textFPS.Text = "            FPS: " + HighResolutionTimer.Instance.FramesPerSecond.ToString();
            textFPS.render();

            textoContadorTiempo.render();
            textoMejorTiempo.render();
            piramid.render();
            renderEscena(elapsedTime);
            device.Transform.Projection =
                Matrix.PerspectiveFovLH(Geometry.DegreeToRadian(45.0f),
                TgcD3dDevice.aspectRatio, 1f, 20000f);

            skyBox.render();
        }