Beispiel #1
0
        public MyAirplane(Device d3d, System.Drawing.Font font, Microsoft.DirectX.DirectSound.Device dsound, Landscape l)
        {
            measure.Start();
            d3dxfont   = new Microsoft.DirectX.Direct3D.Font(d3d, font);
            myAirplane = new airplane(d3d);
            landscape  = l;
            idevice    = new InputDevice();
            d3dDevice  = d3d;
            gunshots   = new ShootingClass(d3d, dsound);
            //	didev=di;
            rotation = new Quaternion();
            rotation = Quaternion.Identity;
            rotation.RotateYawPitchRoll((float)Math.PI, 0f, 0f);

            // the airplane starts with 20º angle (landed)
            //	rotation.RotateYawPitchRoll(0, -0.34906585f, 0);

            m_matOrientation = new Matrix();
            m_matOrientation.Translate(0, 0, 0);

            m_vPosition   = new Vector3(1, 1, -10);
            prepos        = m_vPosition;
            m_vVelocity   = new Vector3(0, 0, 0);
            gravityVector = new Vector3(0, 0, 0);
            liftVector    = new Vector3(0, 0, 0);
            trustVector   = new Vector3(0, 0, 0);
            dragVector    = new Vector3(0, 0, 0);
            speedVector   = new Vector3(0, 0, 0);
            mass          = weight / gravity;

            m_matView = new Matrix();
            oldView   = new Matrix();
        }
        public Sonidos(string mediaDir, Microsoft.DirectX.DirectSound.Device sonidoDevice)
        {
            MediaDir     = mediaDir;
            SonidoDevice = sonidoDevice;

            // Sonidos
            Musica = new TgcStaticSound();
            Musica.loadSound(MediaDir + "Musica\\Running90s.wav", -1800, SonidoDevice);

            Tribuna = new TgcStaticSound();
            Tribuna.loadSound(MediaDir + "Musica\\Tribuna.wav", -400, SonidoDevice);

            Aplausos = new TgcStaticSound();
            Aplausos.loadSound(MediaDir + "Musica\\Aplausos.wav", -100, SonidoDevice);

            GameOver = new TgcStaticSound();
            GameOver.loadSound(MediaDir + "Musica\\GameOver.wav", -100, SonidoDevice);

            Aceleracion = new TgcStaticSound();
            Aceleracion.loadSound(MediaDir + "Musica\\Motor2.wav", -1700, SonidoDevice);

            Frenada = new TgcStaticSound();
            Frenada.loadSound(MediaDir + "Musica\\Frenada.wav", -2000, SonidoDevice);

            Choque = new TgcStaticSound();
            Choque.loadSound(MediaDir + "Musica\\Choque1.wav", -2000, SonidoDevice);

            //Motor = new Tgc3dSound(MediaDir + "Musica\\Motor2.wav", Auto.Mayas[0].Position, SonidoDevice);
            //Motor.MinDistance = 80f;
        }
        public Sonidos(string mediaDir, Microsoft.DirectX.DirectSound.Device sonidoDevice)
        {
            MediaDir     = mediaDir;
            SonidoDevice = sonidoDevice;
            // Sonidos
            int volumen1   = -1800; // RANGO DEL 0 AL -10000 (Silenciado al -10000)
            var pathMusica = MediaDir + "Musica\\Running90s.wav";

            Musica = new TgcStaticSound();
            Musica.loadSound(pathMusica, volumen1, SonidoDevice);

            int volumen2    = -400;
            var pathTribuna = MediaDir + "Musica\\Tribuna.wav";

            Tribuna = new TgcStaticSound();
            Tribuna.loadSound(pathTribuna, volumen2, SonidoDevice);

            var pathAplausos = MediaDir + "Musica\\Aplausos.wav";

            Aplausos = new TgcStaticSound();
            Aplausos.loadSound(pathTribuna, -100, SonidoDevice);

            var pathGameOver = MediaDir + "Musica\\GameOver.wav";

            GameOver = new TgcStaticSound();
            GameOver.loadSound(pathGameOver, -100, SonidoDevice);
        }
Beispiel #4
0
 public void Perseguir(float elapsedTime, string soundPath, Microsoft.DirectX.DirectSound.Device device)
 {
     Move(ObtenerMovimiento() * elapsedTime);
     if (PuedeDisparar())
     {
         Disparar(naveAPerseguir.GetPosition(), soundPath, device);
     }
 }
Beispiel #5
0
        void init()
        {
            Microsoft.DirectX.Direct3D.PresentParameters pps = new Microsoft.DirectX.Direct3D.PresentParameters();
            pps.SwapEffect           = Microsoft.DirectX.Direct3D.SwapEffect.Discard;
            pps.Windowed             = true;
            pps.BackBufferCount      = 1;
            pps.PresentationInterval = PresentInterval.One;
            pps.BackBufferFormat     = Format.A8R8G8B8;

            if (GameWindow == null)
            {
                //pps.BackBufferWidth = GameControl.Width;
                //pps.BackBufferHeight = GameControl.Height;
                D3DDev = new Microsoft.DirectX.Direct3D.Device(0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, GameControl, Microsoft.DirectX.Direct3D.CreateFlags.SoftwareVertexProcessing, pps);
            }
            else
            {
                //pps.BackBufferWidth = GameWindow.Width;
                //pps.BackBufferHeight = GameWindow.Height;
                D3DDev = new Microsoft.DirectX.Direct3D.Device(0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, GameWindow, Microsoft.DirectX.Direct3D.CreateFlags.SoftwareVertexProcessing, pps);
            }
            D3DDev.VertexFormat = CustomVertex.PositionColoredTextured.Format;


            //D3DDev.ShowCursor(false);

            DSoundDev = new Microsoft.DirectX.DirectSound.Device();
            if (GameWindow == null)
            {
                DSoundDev.SetCooperativeLevel(GameControl, Microsoft.DirectX.DirectSound.CooperativeLevel.Normal);
            }
            else
            {
                DSoundDev.SetCooperativeLevel(GameWindow, Microsoft.DirectX.DirectSound.CooperativeLevel.Normal);
            }

            DKeyboardDev = new Microsoft.DirectX.DirectInput.Device(Microsoft.DirectX.DirectInput.SystemGuid.Keyboard);
            DKeyboardDev.Acquire();

            DMouseDev = new Microsoft.DirectX.DirectInput.Device(Microsoft.DirectX.DirectInput.SystemGuid.Mouse);
            DMouseDev.Acquire();

            VertexBuffer = new VertexBuffer(typeof(CustomVertex.PositionColoredTextured), 6, D3DDev, Usage.None, CustomVertex.PositionColoredTextured.Format, Pool.Managed);

            D3DDev.SetStreamSource(0, VertexBuffer, 0);
            D3DDev.TextureState[0].AlphaOperation = TextureOperation.Modulate;

            Sprite = new Sprite(D3DDev);

            FontDescription fd = new FontDescription();

            fd.FaceName = "新宋体";
            fd.Height   = -12;
            Font2D      = new Microsoft.DirectX.Direct3D.Font(D3DDev, fd);

            Font3D = new System.Drawing.Font("新宋体", 12);
        }
Beispiel #6
0
 private static void changeMode(string mode)
 {
     string strMode = "";
     Microsoft.DirectX.DirectSound.Device dev = new Microsoft.DirectX.DirectSound.Device(Guid.Empty);
     Microsoft.DirectX.DirectSound.Speakers s = new Microsoft.DirectX.DirectSound.Speakers();
     s.FivePointOne = false;
     s.GeometryMax = false;
     s.GeometryMin = false;
     s.GeometryNarrow = false;
     s.GeometryWide = false;
     s.Headphone = false;
     s.Mono = false;
     s.Quad = false;
     s.SevenPointOne = false;
     s.Stereo = false;
     s.Surround = false;
     switch (mode)
     {
         case "hp":
             s.Headphone = true;
             strMode = "Headphones";
             break;
         case "1":
             strMode = "Monophonic speaker (1.0)";
             s.Mono = true;
             break;
         case "2":
             strMode = "Desktop stereo speakers (2.0)";
             s.Stereo = true;
             break;
         case "4":
             strMode = "Quadraphonic speakers (4.0)";
             s.Quad = true;
             break;
         case "5":
             strMode = "Surround sound speakers (5.0)";
             s.Surround = true;
             break;
         case "5.1":
             strMode = "5.1 surround sound speakers";
             s.FivePointOne = true;
             break;
         case "7.1":
             strMode = "7.1 speakers";
             s.SevenPointOne = true;
             s.Mono = true;
             break;
     }
     dev.SpeakerConfig = s;
     dev.Dispose();
     Console.WriteLine(strMode + " mode successfully set");
 }
 // TODO: Agregar un target con el mouse o algo para que dispare a cierta direccion no solo para adelante.
 public bool Disparar(TGCVector3 targetPosition, string soundPath, Microsoft.DirectX.DirectSound.Device device)
 {
     if (shotLimiter.ElapsedMilliseconds > cooldownDisparo)
     {
         if (minDistance != -1)
         {
             disparos.Add(new Disparo(position, targetPosition, shotSize, shotColor, soundPath, device, minDistance));
         }
         else
         {
             this.disparos.Add(new Disparo(position, targetPosition, shotSize, shotColor, soundPath, device));
         }
         shotLimiter.Restart();
         return(true);
     }
     return(false);
 }
        public SoundManager(Directorio directorio, Microsoft.DirectX.DirectSound.Device dsDevice)
        {
            Directorio = directorio;

            //Cargo archivo de sonido background mp3.
            mp3BackgroundPlayer.closeFile();
            mp3BackgroundPlayer.FileName = directorio.SonidoFondo;

            mp3FruitPlayer.closeFile();
            mp3FruitPlayer.FileName = directorio.SonidoFruta;

            //Cargo sonidos estaticos.
            SonidoSalto.loadSound(directorio.SonidoSalto, dsDevice);
            SonidoMoneda.loadSound(directorio.SonidoMoneda, dsDevice);
            SonidoDanio.loadSound(directorio.SonidoDanio, dsDevice);
            SonidoCaminar.loadSound(directorio.SonidoCaminar, dsDevice);

            //mp3SaltosPlayer.closeFile();
            //mp3SaltosPlayer.FileName = directorio.SonidoSalto;
        }
Beispiel #9
0
        /// <summary>
        /// Creates a new JSong.
        /// </summary>
        /// <param name="filePath">The filepath for the JSong.</param>
        public JSong(string filePath, Microsoft.DirectX.DirectSound.Device audioDevice)
        {
            Microsoft.DirectX.DirectSound.BufferDescription desc = new Microsoft.DirectX.DirectSound.BufferDescription();

            if (JfxCompatible)
            {
                desc.ControlEffects   = true;
                desc.ControlFrequency = true;
                desc.ControlPan       = true;
                desc.ControlVolume    = true;
                desc.Control3D        = true;
            }
            else
            {
                desc.ControlEffects = false;
                desc.ControlVolume  = true;
                desc.Control3D      = true;
            }

            music        = new Microsoft.DirectX.DirectSound.SecondaryBuffer(desc, audioDevice);
            music.Volume = properties.Volume;

            CurrentState = MediaStates.Playing;
        }
Beispiel #10
0
 public Disparo(TGCVector3 startPosition, TGCVector3 targetPosition, TGCVector3 size, Color color, string soundPath, Microsoft.DirectX.DirectSound.Device device, float minDistance) : this(startPosition, targetPosition, size, color, soundPath, device)
 {
     sonido.MinDistance = minDistance;
 }
Beispiel #11
0
        void init()
        {
            Microsoft.DirectX.Direct3D.PresentParameters pps = new Microsoft.DirectX.Direct3D.PresentParameters();
            pps.SwapEffect = Microsoft.DirectX.Direct3D.SwapEffect.Discard;
            pps.Windowed = true;
            pps.BackBufferCount = 1;
            pps.PresentationInterval = PresentInterval.One;
            pps.BackBufferFormat = Format.A8R8G8B8;

            if (GameWindow == null)
            {
                //pps.BackBufferWidth = GameControl.Width;
                //pps.BackBufferHeight = GameControl.Height;
                D3DDev = new Microsoft.DirectX.Direct3D.Device(0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, GameControl, Microsoft.DirectX.Direct3D.CreateFlags.SoftwareVertexProcessing, pps);
            }
            else
            {
                //pps.BackBufferWidth = GameWindow.Width;
                //pps.BackBufferHeight = GameWindow.Height;
                D3DDev = new Microsoft.DirectX.Direct3D.Device(0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, GameWindow, Microsoft.DirectX.Direct3D.CreateFlags.SoftwareVertexProcessing, pps);
            }
            D3DDev.VertexFormat = CustomVertex.PositionColoredTextured.Format;

            //D3DDev.ShowCursor(false);

            DSoundDev = new Microsoft.DirectX.DirectSound.Device();
            if (GameWindow == null)
            {
                DSoundDev.SetCooperativeLevel(GameControl, Microsoft.DirectX.DirectSound.CooperativeLevel.Normal);
            }
            else
            {
                DSoundDev.SetCooperativeLevel(GameWindow, Microsoft.DirectX.DirectSound.CooperativeLevel.Normal);
            }

            DKeyboardDev = new Microsoft.DirectX.DirectInput.Device(Microsoft.DirectX.DirectInput.SystemGuid.Keyboard);
            DKeyboardDev.Acquire();

            DMouseDev = new Microsoft.DirectX.DirectInput.Device(Microsoft.DirectX.DirectInput.SystemGuid.Mouse);
            DMouseDev.Acquire();

            VertexBuffer = new VertexBuffer(typeof(CustomVertex.PositionColoredTextured), 6, D3DDev, Usage.None, CustomVertex.PositionColoredTextured.Format, Pool.Managed);

            D3DDev.SetStreamSource(0, VertexBuffer, 0);
            D3DDev.TextureState[0].AlphaOperation = TextureOperation.Modulate;

            Sprite = new Sprite(D3DDev);

            FontDescription fd = new FontDescription();
            fd.FaceName = "新宋体";
            fd.Height = -12;
            Font2D = new Microsoft.DirectX.Direct3D.Font(D3DDev, fd);

            Font3D = new System.Drawing.Font("新宋体", 12);
        }
Beispiel #12
0
 public void setSoundBotiquin(string path, Microsoft.DirectX.DirectSound.Device device)
 {
     soundBotiquin = new TgcStaticSound();
     soundBotiquin.loadSound(path, device);
 }
        public AutoManejable(List <TgcMesh> mayas, TGCVector3 posicionInicial, float direccionInicialEnGrados, FisicaMundo fisica, string pathHumo, string mediaDir, Microsoft.DirectX.DirectSound.Device sonido) : base(mayas, posicionInicial, direccionInicialEnGrados, fisica, pathHumo, mediaDir, sonido)
        {
            Direccion = 1;
            //Cuerpo Rigido Auto
            FriccionAuto = 0.1f;
            var tamañoAuto = new TGCVector3(25, AlturaCuerpoRigido, 80);

            CuerpoRigidoAuto             = BulletRigidBodyFactory.Instance.CreateBox(tamañoAuto, 100, PosicionInicial, 0, 0, 0, FriccionAuto, true);
            CuerpoRigidoAuto.Restitution = 0.3f;
            //CuerpoRigidoAuto.RollingFriction = 1000000;
            Fisica.dynamicsWorld.AddRigidBody(CuerpoRigidoAuto);
        }
Beispiel #14
0
 public PoliciasIA(List <TgcMesh> mayas, FisicaMundo fisica, string pathHumo, AutoManejable[] enemigos, string mediaDir, Microsoft.DirectX.DirectSound.Device sonido)
 {
     Policia01 = new AutoIA(mayas, new TGCVector3(-1000, 0, 0), 270, fisica, pathHumo, enemigos, mediaDir, sonido);
     Policia02 = new AutoIA(mayas, new TGCVector3(0, 0, 0), 270, fisica, pathHumo, enemigos, mediaDir, sonido);
     Policia03 = new AutoIA(mayas, new TGCVector3(1000, 0, 0), 270, fisica, pathHumo, enemigos, mediaDir, sonido);
     Policia04 = new AutoIA(mayas, new TGCVector3(2000, 0, 0), 270, fisica, pathHumo, enemigos, mediaDir, sonido);
     Policia05 = new AutoIA(mayas, new TGCVector3(3000, 0, 0), 270, fisica, pathHumo, enemigos, mediaDir, sonido);
     Policia06 = new AutoIA(mayas, new TGCVector3(-1000, 0, 300), 270, fisica, pathHumo, enemigos, mediaDir, sonido);
     Policia07 = new AutoIA(mayas, new TGCVector3(0, 0, 300), 270, fisica, pathHumo, enemigos, mediaDir, sonido);
     Policia08 = new AutoIA(mayas, new TGCVector3(1000, 0, 300), 270, fisica, pathHumo, enemigos, mediaDir, sonido);
     Policia09 = new AutoIA(mayas, new TGCVector3(2000, 0, 300), 270, fisica, pathHumo, enemigos, mediaDir, sonido);
     Policia10 = new AutoIA(mayas, new TGCVector3(3000, 0, 300), 270, fisica, pathHumo, enemigos, mediaDir, sonido);
     Todos     = new List <AutoIA>
     {
         Policia01,
         Policia02,
         Policia03,
         Policia04,
         Policia05,
         Policia06,
         Policia07,
         Policia08,
         Policia09,
         Policia10
     };
 }
 public ObjectSound()
 {
     ImplementUserControl();
     Microsoft.DirectX.DirectSound.Device device = new Microsoft.DirectX.DirectSound.Device();
 }
Beispiel #16
0
 public bool Disparar(string soundPath, Microsoft.DirectX.DirectSound.Device device)
 {
     return(ArmaPrincipal.Disparar(this.MovementVector - new TGCVector3(0f, 0f, 1f), soundPath, device));
 }
Beispiel #17
0
        public override void Init()
        {
            var d3dDevice = D3DDevice.Instance.Device;

            deviceMusica         = DirectSound.DsDevice;
            this.FixedTickEnable = false;

            GameModel.instancia = this;
            musicaMenu          = new Sonido("SonidoPruebaTGC(Mono).wav", true);
            musicaFondoOutdoor  = new Sonido("nocturno, continuo.wav", -3000, true);
            estatica            = new Sonido("Radio Static-SoundBible.com-629277574.wav", -2500, true);
            agarrarPagina       = new Sonido("Page_Turn-Mark_DiAngelo-1304638748.wav", -300, false);
            humanHeartbeat      = new Sonido("human-heartbeat-daniel_simon.wav", -1000, false);
            respiracion         = new Sonido("Breathing Vent-SoundBible.com-18702822.wav", -600, false);

            //CreateFullScreenQuad();
            CreateRenderTarget();

            personaje = new Personaje();
            menu.instanciarMenu();
            nota.instanciarNotas(0);
            vidaUtilVela.instanciarVelas(0);
            velita.instanciarVelita();
            vidaUtilLinterna.instanciarLinternas(0);
            linternita.instanciarLinternita();
            InstanciarSonidosRandoms();
            InstanciarSonidosOutDoorRandoms();
            InstanciasSonidosInDoorRandoms();

            escenario.InstanciarEstructuras();
            monster = new Monster();
            monster.InstanciarMonster(monstruoActual);
            CrearObjetosEnEscenario();
            //iluminables.Add(monster.ghost);
            //iluminables.AddRange(escenario.tgcScene.Meshes);

            TgcMesh mesh1    = escenario.tgcScene.Meshes.Find(mesh => mesh.Name.Equals("linterna_1"));
            TgcMesh mesh2    = escenario.tgcScene.Meshes.Find(mesh => mesh.Name.Equals("linterna_2"));
            var     linterna = new Linterna(mesh1, mesh2, this);

            objetosInteractuables.Add(linterna);

            Camera = personaje;

            quads = new List <FullscreenQuad>();

            //ShadersDir
            effectPosProcesado           = TGCShaders.Instance.LoadEffect(ShadersDir + "PostProcesado.fx");
            effectPosProcesado.Technique = "PostProcessDefault";
            var unQuad = new FullscreenQuad(effectPosProcesado);

            unQuad.loEstoyUsando = true;
            this.quads.Add(unQuad);

            sombras = new Sombras(this);
            sombras.InstanciarSombras();

            this.renderizado = sombras;

            monsterBlur = new MonsterBlur(escenario, this);
            monsterBlur.instanciarMonsterBlur(ShadersDir, monster, MediaDir);
        }
Beispiel #18
0
 public void setSound(string path, Microsoft.DirectX.DirectSound.Device device)
 {
     soundPuerta = new TgcStaticSound();
     soundPuerta.loadSound(path, device);
 }
Beispiel #19
0
 public Disparo(TGCVector3 startPosition, TGCVector3 targetPosition, TGCVector3 size, Color color, string soundPath, Microsoft.DirectX.DirectSound.Device device)
 {
     vida                 = Stopwatch.StartNew();
     ShouldDie            = false;
     modelo               = TGCBox.fromSize(size, color);
     modelo.AutoTransform = true;
     modelo.Position      = startPosition;
     MovementDirection    = TGCVector3.Normalize(targetPosition - startPosition);
     modelo.Rotation      = new TGCVector3(ObtenerRotacionX(new TGCVector3(0, 0, 1), MovementDirection), ObtenerRotacionY(new TGCVector3(0, 0, 1), MovementDirection), 0);
     this.OOB             = TgcBoundingOrientedBox.computeFromAABB(modelo.BoundingBox);
     //this.OOB.move(this.MovementDirection);
     this.OOB.rotate(modelo.Rotation);
     this.sonido        = new Tgc3dSound(soundPath, modelo.Position, device);
     sonido.Position    = modelo.Position;
     sonido.MinDistance = 50f;
     sonido.play();
     //modelo.BoundingBox.transform(TGCMatrix.RotationYawPitchRoll(modelo.Rotation.Y,modelo.Rotation.X,0));
 }
Beispiel #20
0
 public bool Disparar(TGCVector3 target, string soundPath, Microsoft.DirectX.DirectSound.Device device)
 {
     return(ArmaPrincipal.Disparar(target, soundPath, device));
 }