Esempio n. 1
0
        private SoundManager()
        {
            pasoIzq = new TgcStaticSound();
            pasoDer = new TgcStaticSound();
            tiempoCordinacionCaminar = DateTime.Now;

            sonidoDisparo = new TgcStaticSound();
            sonidoRecarga = new TgcStaticSound();
            sonidoPasoEnemigo = new TgcStaticSound();
            sonidoEnemMuerto = new TgcStaticSound();
            sonidoEnemigoAlcanzaPersonaje = new TgcStaticSound();
            sonidoBackground = new TgcStaticSound();
            sonidoMunicion = new TgcStaticSound();
            sonidoAviso = new TgcStaticSound();
            sonidoFin = new TgcStaticSound();
            sinMunicion = new TgcStaticSound();
            explosion = new TgcStaticSound();
            headshot = new TgcStaticSound();
            vientoLigero = new TgcStaticSound();
            vientoFuerte = new TgcStaticSound();

            sinMunicion.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "\\RenderMan\\sonidos\\sinMunicion.wav");

            pasoIzq.loadSound (GuiController.Instance.AlumnoEjemplosMediaDir + "\\RenderMan\\sonidos\\pasoIzq.wav");
            pasoDer.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "\\RenderMan\\sonidos\\pasoDer.wav");

            sonidoPasoEnemigo.loadSound(GuiController.Instance.ExamplesMediaDir + "\\Sound\\pisada hierba dcha.wav");
            sonidoEnemMuerto.loadSound(GuiController.Instance.ExamplesMediaDir + "\\Sound\\golpe seco.wav");

            sonidoDisparo.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "\\" + EjemploAlumno.nombreGrupo + "\\sonidos\\armas\\sonidoDisparo.wav");

            sonidoRecarga.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "\\" + EjemploAlumno.nombreGrupo + "\\sonidos\\armas\\Pump_Shotgun 2x-SoundBible.com-278688366.wav");

            sonidoBackground.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "\\" + EjemploAlumno.nombreGrupo + "\\sonidos\\background-alternativo.wav");
            sonidoBackground.play();

            vientoLigero.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "\\" + EjemploAlumno.nombreGrupo + "\\sonidos\\Pure Arctic Wind Corto.wav");
            vientoLigero.play();

            vientoFuerte.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "\\" + EjemploAlumno.nombreGrupo + "\\sonidos\\Ventizca Fuerte.wav");

            sonidoEnemigoAlcanzaPersonaje.loadSound(GuiController.Instance.ExamplesMediaDir + "\\Sound\\puñetazo.wav");
            sonidoMunicion.loadSound(GuiController.Instance.ExamplesMediaDir + "\\Sound\\tic.wav");
            sonidoAviso.loadSound(GuiController.Instance.ExamplesMediaDir + "\\Sound\\sirena, continuo.wav");

            sonidoFin.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "\\" + EjemploAlumno.nombreGrupo + "\\sonidos\\background-alternativo.wav");

            explosion.loadSound(GuiController.Instance.ExamplesMediaDir + "\\Sound\\explosión, grande.wav");
            headshot.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "\\" + EjemploAlumno.nombreGrupo + "\\sonidos\\headshot.wav");

            esPasoIzquierdo = true;
        }
Esempio n. 2
0
 public void playSound(TgcStaticSound sound, string dir, bool loop)
 {
     //reproducir un sonido
     sound.dispose();
     sound.loadSound(dir, HUDManager.Instance.PLAYER_VOLUME);
     sound.play(loop);
 }
        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;
        }
Esempio n. 4
0
        public PlayScene()
        {
            string mediaDir = GuiController.Instance.AlumnoEjemplosMediaDir;
            string examplesMediaDir = GuiController.Instance.ExamplesMediaDir;

            TgcTexture pisoTexture = TgcTexture.createTexture(GuiController.Instance.D3dDevice,
                 mediaDir + "CEGA\\Textures\\Grass.jpg");

            suelo = TgcBox.fromSize(new Vector3(1300, 0, 1300), new Vector3(2800, 0, 2800), pisoTexture);

            heightMap = new SimpleTerrain();

            heightMap.loadHeightmap(GuiController.Instance.AlumnoEjemplosMediaDir + "CEGA\\Heightmap\\" + "hmap4.jpg", 26, 0.4f, new Vector3(52, 0, 48));
            heightMap.loadTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "CEGA\\Textures\\" + "Pasto2.jpg");

            treeWindEffect = TgcShaders.loadEffect(
                GuiController.Instance.AlumnoEjemplosMediaDir + "CEGA\\Shaders\\TreeWind.fx");

            TgcSceneLoader loader = new TgcSceneLoader();
            TgcScene scene = loader.loadSceneFromFile(mediaDir + "CEGA\\Pino-TgcScene.xml");
            TgcMesh pinoOriginal = scene.Meshes[0];

            scene = loader.loadSceneFromFile(mediaDir + "CEGA\\BarrilPolvora-TgcScene.xml");
            TgcMesh barrilOriginal = scene.Meshes[0];

            scene = loader.loadSceneFromFile(mediaDir + "CEGA\\Pasto3-TgcScene.xml");
            pastoOriginal = scene.Meshes[0];

            //Crear varias instancias del modelo original, pero sin volver a cargar el modelo entero cada vez, hace 23*23 = 529 pinos
            int rows = 22;
            int cols = 22;

            Random RandomPlayScene = new Random(10);

            int offset = RandomPlayScene.Next(100);

            otrosObjetos = new List<TgcMesh>();

            for (int i = 1; i <= rows; i++)
            {
                for (int j = 1; j <= cols; j++)
                {
                    //Randomeo el proximo offset, de esta forma nunca vamos a tener 2 escenarios iguales, si queremos evitar que se superpongan cosas hay que fijarse acá.
                    //Si les parece que quedan muy concentrados en el origen podemos separarlo en 2 For (o en 4) para que no se peguen tanto cuando i=1 y j=1.

                    offset = RandomPlayScene.Next(50, 150);
                    scale = RandomPlayScene.Next(10, 30);

                    //Me fijo que quede dentro de los limites del mapa

                    if (i * offset > 2600 || j * offset > 2600)
                        offset = RandomPlayScene.Next(10, 100);

                    //Crear instancia de modelo
                    //  Barriles
                    if (i == 21)
                    {
                        TgcMesh BarrilInstance = barrilOriginal.createMeshInstance(barrilOriginal.Name + i + j);
                        BarrilInstance.move(j * offset, 0, i * offset);
                        BarrilInstance.AlphaBlendEnable = true;
                        BarrilInstance.Scale = new Vector3(0.09f, 0.09f, 0.09f);

                        // gana algunos fps
                        BarrilInstance.AutoTransformEnable = false;
                        BarrilInstance.Transform =
                            Matrix.Scaling(BarrilInstance.Scale) *
                            Matrix.Translation(BarrilInstance.Position);

                        BarrilInstance.UserProperties = new Dictionary<string, string>();
                        BarrilInstance.UserProperties["colisionable"] = "";

                        otrosObjetos.Add(BarrilInstance);
                    }

                    //  Pinos
                    //

                    TgcMesh instance = pinoOriginal.createMeshInstance(pinoOriginal.Name + i + "_" + j);

                    instance.AlphaBlendEnable = true;
                    instance.Position = new Vector3(i * offset, 0, j * offset);
                    instance.Scale = new Vector3(0.05f * (scale), 0.05f * (scale), 0.05f * (scale));

                    // gana algunos fps
                    instance.AutoTransformEnable = false;
                    instance.Transform =
                        Matrix.Scaling(instance.Scale) *
                        Matrix.Translation(instance.Position);

                    instance.UserProperties = new Dictionary<string, string>();
                    instance.UserProperties["colisionable"] = "";

                    //Modifico el BB del arbol para que sea solo el tronco
                    instance.AutoUpdateBoundingBox = false;
                    instance.BoundingBox.scaleTranslate(instance.Position, new Vector3(0.0012f * instance.BoundingBox.calculateSize().X, 0.0016f * instance.BoundingBox.calculateSize().Y, 0.0012f * instance.BoundingBox.calculateSize().Z));
                    //Effecto de Viento (Shader);
                    instance.Effect = treeWindEffect;
                    instance.Technique = "SimpleWindTree";
                    //Agrego a la coleccion
                    otrosObjetos.Add(instance);

                    //  Bancos de Pasto

                    if ( j == 20)
                    generarBancoPasto(otrosObjetos, new Vector3(j * offset, 0, i * offset), RandomPlayScene);

                }

            }

            //Sky Box

            string texturesPath = mediaDir + "CEGA\\Skyboxes\\SkyBox4\\";

            //Creo el SkyBox
            skyBox = new TgcSkyBox();
            skyBox.Center = new Vector3(1300, 250, 1300);
            skyBox.Size = new Vector3(4000, 1500, 4000);

            //Cargo las texturas de las caras, (algunas no tienen "down" así que uso TOP, por que igual no se debería ver en nuestro caso)
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "top.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "top.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "left.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "right.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "front.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "back.jpg");

            //Actualizar todos los valores para crear el SkyBox
            skyBox.updateValues();

            sound_WindLong = new TgcStaticSound();
            sound_WindLong.loadSound(mediaDir + @"CEGA\Sound\viento_largo.wav", -2000);

            sound_WindMedium = new TgcStaticSound();
            sound_WindMedium.loadSound(mediaDir + @"CEGA\Sound\viento_medio.wav", -2000);

            sound_WindLeaves = new TgcStaticSound();
            sound_WindLeaves.loadSound(examplesMediaDir + @"\Sound\viento en arbustos.wav", -2000);

            sound_music = new TgcStaticSound();
            sound_music.loadSound(mediaDir + @"CEGA\Sound\rabbia.wav", -2000);
            sound_music.play(true);

            //Crear Grilla
            grilla = new GrillaRegular();
            grilla.create(otrosObjetos, heightMap.BoundingBox);
            grilla.createDebugMeshes();
        }
 private void play(TgcStaticSound[] sounds)
 {
     if (sounds.Length != 0)
     {
         /*if (lastPlayed == null || !lastPlayed.SoundBuffer.Status.Playing)
         {*/
             lastPlayed = sounds[random.Next(0, sounds.Length)];
             lastPlayed.play();
         //}
     }
 }
Esempio n. 6
0
File: Tank.cs Progetto: faloi/tegece
 protected void shoot()
 {
     var flightTimeOfLastMissile = 0f;
     foreach (var missile in missilesShooted) {
         if (flightTimeOfLastMissile == 0f)
             flightTimeOfLastMissile = missile.flightTime;
         else if (flightTimeOfLastMissile < missile.flightTime) {
             flightTimeOfLastMissile = missile.flightTime;
         }
     }
     if (INTERVAL_BETWEEN_MISSILES<=flightTimeOfLastMissile || missilesShooted.Count==0) {
         this.setInitMissileRotation();
         var newMissile = new Missile(realPosition, this.initMissileRotation);
         TgcStaticSound sound = new TgcStaticSound();
         sound.loadSound(Path.ExplosionSound);
         sound.play(false);
         missilesShooted.Add(newMissile);
     }
 }
Esempio n. 7
0
File: Tank.cs Progetto: faloi/tegece
        protected virtual void processSuccessfulShot()
        {
            this.score++;
            this.enemy.blockTank();

            if (this.score == 5) {
                var endOfGameSound = new TgcStaticSound();
                endOfGameSound.loadSound(Shared.MediaFolder + string.Format(@"Sound\{0}.wav", soundName));
                endOfGameSound.play(false);
            }
        }