Ejemplo n.º 1
0
        public void renderizar()
        {
            #region RENDERIZAR ESCENARIO
            skyBox.render();
            lightMesh.render();
            #endregion

            #region RENDERIZAR PANTALLA
            GuiController.Instance.Drawer2D.beginDrawSprite();

            camara = (Boolean)GuiController.Instance.Modifiers["camaraEnBarco"];

            if (camara)
            {
                animatedSprite2.Scaling  = new Vector2(1.4f, 1.4f);
                animatedSprite2.Position = new Vector2(traslacion, 0);
                animatedSprite2.setFrameRate(3);
                traslacion = traslacion + 12;
            }
            else
            {
                animatedSprite2.Scaling  = new Vector2(0.4f, 0.4f);
                animatedSprite2.Position = new Vector2(traslacion, screenSize.Height / 3);
                animatedSprite2.setFrameRate(1);
                traslacion = traslacion + 4;
            }
            if (traslacion > screenSize.Width)
            {
                animatedSprite2.dispose();
            }
            else
            {
                animatedSprite2.updateAndRender();
            }

            llueve = (Boolean)GuiController.Instance.Modifiers["lluvia"];
            if (llueve)
            {
                animatedSprite.updateAndRender();
            }
            boton1.render();
            boton2.render();
            barra.render();
            timon.render();

            GuiController.Instance.Drawer2D.endDrawSprite();
            #endregion
        }
Ejemplo n.º 2
0
        public override void render(float elapsedTime)
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;


            //Actualizar valores cargados en modifiers
            animatedSprite.setFrameRate((float)GuiController.Instance.Modifiers["frameRate"]);
            animatedSprite.Position = (Vector2)GuiController.Instance.Modifiers["position"];
            animatedSprite.Scaling  = (Vector2)GuiController.Instance.Modifiers["scaling"];
            animatedSprite.Rotation = FastMath.ToRad((float)GuiController.Instance.Modifiers["rotation"]);


            //Dibujar box3D. Se deben dibujar primero todos los objetos 3D. Recien al final dibujar los Sprites
            box.render();


            //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í)
            //Actualizamos el estado de la animacion y renderizamos
            animatedSprite.updateAndRender();

            //Finalizar el dibujado de Sprites
            GuiController.Instance.Drawer2D.endDrawSprite();
        }
Ejemplo n.º 3
0
        public static TgcAnimatedSprite crearExplosion()
        {
            //Crear Sprite animado
            TgcAnimatedSprite animatedSprite = 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
                );

            animatedSprite.setFrameRate(10);
            animatedSprite.Scaling  = new Vector2(1, 1);
            animatedSprite.Rotation = 0;
            //animatedSprite.Position = posicion;
            return(animatedSprite);
        }
Ejemplo n.º 4
0
        public void crearExplosion(Vector3 posicion3D)
        {
            float x = 450; // posicion3D.X / posicion3D.Z;
            float y = 200; // posicion3D.Y / posicion3D.Z;

            Vector2 posicion2D = new Vector2(x, y);

            //Crear Sprite animado
            animatedSprite = 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
                );

            animatedSprite.setFrameRate(10);
            animatedSprite.Scaling  = new Vector2(1, 1);
            animatedSprite.Rotation = 0;
            animatedSprite.Position = posicion2D;
        }