public Sonido(String archivo, bool loop)
        {
            ReproduccionActual = archivo;
            var device = GameModel.deviceMusica;

            player.loadSound(this.media + archivo, device);
            player.play(loop);
        }
 public void playSonidoFruta()
 {
     if (estado_sonido)
     {
         //mp3FruitPlayer.play(false);
         SonidoMoneda.stop();
         SonidoMoneda.play(false);
     }
 }
Ejemplo n.º 3
0
        public void render()
        {
            if (listMuniciones != null)
            {
                for (int i = 0; i <= (listMuniciones.Count - 1); i++)
                {
                    if (listMuniciones[i].getLifeTime() <= 0)
                    {
                        listMuniciones.RemoveAt(i);
                    }
                    else
                    {
                        if (listMuniciones[i].getSonidoShoot())
                        {
                            sonido.play();
                        }

                        listMuniciones[i].update();

                        if (validarVisibilidad(listMuniciones[i]))
                        {
                            listMuniciones[i].render();
                        }
                    }
                }
            }
        }
        public GameSound(Device directSound)
        {
            #region inicializarSonidos
            disparo = new TgcStaticSound();
            string filePath = GameModel.mediaDir + "sonidos\\plop.wav";
            disparo.loadSound(filePath, directSound);

            filePath  = GameModel.mediaDir + "sonidos\\explosion.wav";
            explosion = new TgcStaticSound();
            explosion.loadSound(filePath, directSound);

            filePath   = GameModel.mediaDir + "sonidos\\explosion2.wav";
            explosion1 = new TgcStaticSound();
            explosion1.loadSound(filePath, directSound);

            zombie   = new TgcStaticSound();
            filePath = GameModel.mediaDir + "sonidos\\zombie2.wav";
            zombie.loadSound(filePath, directSound);

            helicoptero = new TgcStaticSound();
            filePath    = GameModel.mediaDir + "sonidos\\helicoptero.wav";
            helicoptero.loadSound(filePath, directSound);

            musica   = new TgcStaticSound();
            filePath = GameModel.mediaDir + "sonidos\\musica.wav";
            musica.loadSound(filePath, directSound);
            musica.play(true);

            piano    = new TgcStaticSound();
            filePath = GameModel.mediaDir + "sonidos\\piano.wav";
            piano.loadSound(filePath, directSound);
            // piano.play(true);
            #endregion
        }
Ejemplo n.º 5
0
        public override void Render()
        {
            PreRender();

            //Ver si cambio el WAV
            var filePath = wavFileModifier.Value;

            loadSound(filePath);

            //Contro el input de teclado
            if (Input.keyPressed(Key.Y))
            {
                var playLoop = playLoopModifier.Value;
                sound.play(playLoop);
            }
            else if (Input.keyPressed(Key.O))
            {
                sound.stop();
            }

            //Render texto
            currentSoundText.render();
            instruccionesText.render();

            PostRender();
        }
Ejemplo n.º 6
0
        public override void render(float elapsedTime)
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Ver si cambio el WAV
            string filePath = (string)GuiController.Instance.Modifiers["WAV-File"];

            loadSound(filePath);


            //Contro el input de teclado
            if (GuiController.Instance.D3dInput.keyPressed(Microsoft.DirectX.DirectInput.Key.Y))
            {
                bool playLoop = (bool)GuiController.Instance.Modifiers["PlayLoop"];
                sound.play(playLoop);
            }
            else if (GuiController.Instance.D3dInput.keyPressed(Microsoft.DirectX.DirectInput.Key.O))
            {
                sound.stop();
            }


            //Render texto
            currentSoundText.render();
            instruccionesText.render();
        }
Ejemplo n.º 7
0
 public void throwSound(Vector3 position)
 {
     if (isInArea(position))
     {
         sound.play(false);
     }
 }
Ejemplo n.º 8
0
 public void playSound(TgcStaticSound sound, string dir, bool loop)
 {
     //reproducir un sonido
     sound.dispose();
     sound.loadSound(dir, PLAYER_VOLUME);
     sound.play(loop);
 }
Ejemplo n.º 9
0
        public override void Render()
        {
            PreRender();

            //Ver si cambio el WAV
            var filePath = (string)Modifiers["WAV-File"];

            loadSound(filePath);

            //Contro el input de teclado
            if (Input.keyPressed(Key.Y))
            {
                var playLoop = (bool)Modifiers["PlayLoop"];
                sound.play(playLoop);
            }
            else if (Input.keyPressed(Key.O))
            {
                sound.stop();
            }

            //Render texto
            currentSoundText.render();
            instruccionesText.render();

            PostRender();
        }
 public void playSonidoDanio()
 {
     if (estado_sonido)
     {
         SonidoDanio.play();
     }
 }
Ejemplo n.º 11
0
        public void render()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "RenderizameLaBanera\\Music\\" + elemento);
            sound.play(false);
        }
Ejemplo n.º 12
0
 protected override void OnContact(ItemContactState contactState, Single deltaTime)
 {
     _IsContactOcurred = true;
     if (_MaxDepth < contactState.Contact.Depth)
     {
         _MaxDepth      = contactState.Contact.Depth;
         _MaxDepthState = contactState;
     }
     if (Scale.Y < _SpringContractedY || _TotalContraction < 0 ||
         !Vector3.Dot(_Collider.Top, contactState.Normal).TolerantEquals(1))
     {
         if (_TotalContraction < 0)
         {
             _Contract(-_TotalContraction);
             if (_SoundEffect != null)
             {
                 _SoundEffect.play(false);
             }
             _TotalContraction = 0;
         }
         base.OnContact(contactState, deltaTime);
     }
     else
     {
         contactState.Interactive.AddForceAt(contactState.Radius, _RealElasticity * _TotalContraction * _Collider.Top);
     }
 }
        public override void Render(float elapsedTime)
        {
            drawer2D.BeginDrawSprite();
            drawer2D.DrawSprite(backgroundSprite);
            drawer2D.EndDrawSprite();

            GuiMessage msg = gui.Update(elapsedTime, Input);

            switch (msg.message)
            {
            case MessageType.WM_COMMAND:
                switch (msg.id)
                {
                case ID_CLOSE:
                    Application.Exit();
                    break;
                }
                break;

            default:
                break;
            }

            gui.Render();

            if (playWinSound)
            {
                playWinSound = false;
                winSound.play();
            }
        }
 public void playSonidoSaltar()
 {
     if (estado_sonido)
     {
         SonidoSalto.play(false);
     }
 }
 public void playSonidoCaminar()
 {
     if (estado_sonido)
     {
         SonidoCaminar.play();
     }
 }
Ejemplo n.º 16
0
 public void playSound(string dir)
 {
     //reproducir un sonido
     sound.dispose();
     sound.loadSound(dir);
     sound.play();
 }
Ejemplo n.º 17
0
 private void reproduceSound()
 {
     if (SoundEnabled)
     {
         sound.play();
     }
 }
Ejemplo n.º 18
0
 public void Load()
 {
     _Sound.play(true);
     _Menu.Add(_Actives);
     Remove(_Actives.ToArray());
     RollBack();
 }
Ejemplo n.º 19
0
        public override void Animate(Single deltaTime)
        {
            _Smoke.Update(deltaTime);
            if (_Load == null)
            {
                return;
            }
            _Load.Position        = Position;
            _Load.Velocity        = Vector3.Empty;
            _Load.AngularVelocity = Vector3.Empty;
            _Load.Momentum        = Vector3.Empty;
            _Load.AngularMomentum = Vector3.Empty;
            var r    = Rotation;
            var step = deltaTime * _RotationSpeed;

            r = Rotation = new Vector3(
                r.X.AdvanceTo(step, _RotationF.X),
                r.Y.AdvanceTo(step, _RotationF.Y),
                r.Z.AdvanceTo(step, _RotationF.Z)
                );

            _ChargeSound.play(false);
            if (r == _RotationF)
            {
                _Shoot();
            }
        }
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Position = _EndOfTheWorld;
     if (_SoundEffect != null)
     {
         _SoundEffect.play(false);
     }
 }
Ejemplo n.º 21
0
 internal void abrirPuerta(Vector3 position)
 {
     if ((distance(position, modeloPuerta.Position)) < 55 && !puertaAbierta)
     {
         changePosition(new Vector3(modeloPuerta.Position.X, 210f + modeloPuerta.Position.Y, modeloPuerta.Position.Z));
         puertaAbierta = true;
         soundPuerta.play(false);
     }
     else
     {
         if ((distance(position, modeloPuerta.Position)) < 255 && puertaAbierta)
         {
             changePosition(new Vector3(modeloPuerta.Position.X, modeloPuerta.Position.Y - 210f, modeloPuerta.Position.Z));
             puertaAbierta = false;
             soundPuerta.play(false);
         }
     }
 }
Ejemplo n.º 22
0
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Position = _Receptor.Position;
     if (_SoundEffect != null)
     {
         _SoundEffect.play(false);
     }
     ClearParts();
 }
Ejemplo n.º 23
0
 public void sonidoRespiracionCadaTanto(float elapsedTime)
 {
     contador2 -= elapsedTime;
     if (contador2 <= 0)
     {
         contador2 = 30f;
         respiracionCadaTanto.play();
     }
 }
Ejemplo n.º 24
0
 public void sonidoMonstruo(float elapsedTime)
 {
     contador -= elapsedTime;
     if (contador <= 0)
     {
         contador = 180f;
         monstruo.play();
     }
 }
Ejemplo n.º 25
0
 public void play(int _volume)
 {
     //setea volumen
     //Min	-10000	 y Max 0
     if (!mute)
     {
         sonido.SoundBuffer.Volume = _volume;
         sonido.play(false);
     }
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Método que reproduce un sonido de trueno aleatorio.
 /// </summary>
 public static void ReproducirTrueno()
 {
     if (Utiles.iAleatorio() % 2 == 0)
     {
         SonidoTrueno1.play();
     }
     else
     {
         SonidoTrueno2.play();
     }
 }
Ejemplo n.º 27
0
        public void loadMP3()
        {
            //GuiController.Instance.Mp3Player.closeFile();
            //GuiController.Instance.Mp3Player.FileName = GuiController.Instance.AlumnoEjemplosMediaDir + "Kamikaze3D\\Explosion\\fx.mp3";
            //GuiController.Instance.Mp3Player.play(false);

            TgcStaticSound sonidoBomba = new TgcStaticSound();

            sonidoBomba.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "Kamikaze3D\\Explosion\\fx.wav");
            sonidoBomba.play();
        }
Ejemplo n.º 28
0
 public static void trueno()
 {
     if (Utiles.iAleatorio() % 2 == 0)
     {
         sonidoTrueno1.play();
     }
     else
     {
         sonidoTrueno2.play();
     }
 }
Ejemplo n.º 29
0
 public void recibirAtaque(int damage)
 {
     hitSound.play(false);
     weapon.FIRE_DELAY = 0.5f;
     vida -= damage;
     HUDManager.Instance.refreshHealth();
     if (vida <= 0)
     {
         GameManager.Instance.gameOver();
     }
 }
Ejemplo n.º 30
0
        private void verificarConfiguracion()
        {
            //Ver si cambio el heightmap
            string selectedHeightmap = (string)GuiController.Instance.Modifiers["heightmap"];

            if (Parametros.getCurrentHMap() != selectedHeightmap)
            {
                //Volver a cargar el Heightmap
                Parametros.setCurrentHMap(selectedHeightmap);
                terrain.loadHeightmap(Parametros.getCurrentHMap(), Parametros.getCurrentScaleXZ(), Parametros.getCurrentScaleY(), new Vector3(0, 0, 0));
            }

            //Ver si cambio alguno de los valores de escala
            float selectedScaleXZ = (float)GuiController.Instance.Modifiers["scaleXZ"];
            float selectedScaleY  = (float)GuiController.Instance.Modifiers["scaleY"];

            if (Parametros.getCurrentScaleXZ() != selectedScaleXZ || Parametros.getCurrentScaleY() != selectedScaleY)
            {
                //Volver a cargar el Heightmap
                Parametros.setCurrentScaleXZ(selectedScaleXZ);
                Parametros.setCurrentScaleY(selectedScaleY);
                terrain.loadHeightmap(Parametros.getCurrentHMap(), Parametros.getCurrentScaleXZ(), Parametros.getCurrentScaleY(), new Vector3(0, 0, 0));
            }

            //Ver si cambio la textura del terreno
            string selectedTexture = (string)GuiController.Instance.Modifiers["texture"];

            if (Parametros.getCurrentTexture() != selectedTexture)
            {
                //Volver a cargar el DiffuseMap
                Parametros.setCurrentTexture(selectedTexture);
                terrain.loadTexture(Parametros.getCurrentTexture());
            }

            //Ver si cambio la opcion de activar sonidos
            if ((bool)GuiController.Instance.Modifiers["sonidoOceano"])
            {
                sonidoAmbienteOceano.play(true);
            }
            else
            {
                sonidoAmbienteOceano.stop();
            }

            if ((bool)GuiController.Instance.Modifiers.getValue("dia"))
            {
                crearSkyBoxDia();
            }
            else
            {
                crearSkyBoxNoche();
            }
        }