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);
     }
 }
示例#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
        }
示例#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();
        }
示例#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();
        }
示例#7
0
 public void throwSound(Vector3 position)
 {
     if (isInArea(position))
     {
         sound.play(false);
     }
 }
 public void playSound(TgcStaticSound sound, string dir, bool loop)
 {
     //reproducir un sonido
     sound.dispose();
     sound.loadSound(dir, PLAYER_VOLUME);
     sound.play(loop);
 }
示例#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();
     }
 }
示例#11
0
        public void render()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "RenderizameLaBanera\\Music\\" + elemento);
            sound.play(false);
        }
示例#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();
     }
 }
示例#16
0
 public void playSound(string dir)
 {
     //reproducir un sonido
     sound.dispose();
     sound.loadSound(dir);
     sound.play();
 }
示例#17
0
 private void reproduceSound()
 {
     if (SoundEnabled)
     {
         sound.play();
     }
 }
 public void Load()
 {
     _Sound.play(true);
     _Menu.Add(_Actives);
     Remove(_Actives.ToArray());
     RollBack();
 }
示例#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);
     }
 }
示例#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);
         }
     }
 }
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Position = _Receptor.Position;
     if (_SoundEffect != null)
     {
         _SoundEffect.play(false);
     }
     ClearParts();
 }
示例#23
0
 public void sonidoRespiracionCadaTanto(float elapsedTime)
 {
     contador2 -= elapsedTime;
     if (contador2 <= 0)
     {
         contador2 = 30f;
         respiracionCadaTanto.play();
     }
 }
示例#24
0
 public void sonidoMonstruo(float elapsedTime)
 {
     contador -= elapsedTime;
     if (contador <= 0)
     {
         contador = 180f;
         monstruo.play();
     }
 }
示例#25
0
 public void play(int _volume)
 {
     //setea volumen
     //Min	-10000	 y Max 0
     if (!mute)
     {
         sonido.SoundBuffer.Volume = _volume;
         sonido.play(false);
     }
 }
示例#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();
     }
 }
示例#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();
        }
示例#28
0
 public static void trueno()
 {
     if (Utiles.iAleatorio() % 2 == 0)
     {
         sonidoTrueno1.play();
     }
     else
     {
         sonidoTrueno2.play();
     }
 }
示例#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();
     }
 }
示例#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();
            }
        }