コード例 #1
0
        public Sonido(String archivo, bool loop)
        {
            ReproduccionActual = archivo;
            var device = GameModel.deviceMusica;

            player.loadSound(this.media + archivo, device);
            player.play(loop);
        }
コード例 #2
0
 public void playSound(TgcStaticSound sound, string dir, bool loop)
 {
     //reproducir un sonido
     sound.dispose();
     sound.loadSound(dir, PLAYER_VOLUME);
     sound.play(loop);
 }
コード例 #3
0
 public void playSound(string dir)
 {
     //reproducir un sonido
     sound.dispose();
     sound.loadSound(dir);
     sound.play();
 }
コード例 #4
0
        public TgcStaticSound GetSound(String soundFile, int volume)
        {
            var sound = new TgcStaticSound();

            sound.loadSound(_SoundFolder + soundFile, volume);
            return(sound);
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        public override void Init()
        {
            int W   = D3DDevice.Instance.Width;
            int H   = D3DDevice.Instance.Height;
            int x0  = W / 2;
            int y0  = H / 2;
            int dy  = 80;
            int dy2 = dy;
            int dx  = 200;

            drawer2D = new Drawer2D();

            backgroundSprite          = new CustomSprite();
            backgroundSprite.Bitmap   = new CustomBitmap(MediaDir + "\\Bitmaps\\youWin.png", D3DDevice.Instance.Device);
            backgroundSprite.Position = new TGCVector2(W * 0.1f, H * 0.2f);
            backgroundSprite.Scaling  = new TGCVector2(1, 1);

            gui.Create(MediaDir);
            gui.InitDialog(false, false);

            //gui.InsertMenuItem(ID_CLOSE, "Cerrar", "close.png", x0, y0, MediaDir, dx, dy);
            //gui.InsertButton(ID_CLOSE, "Salir", x0 - 150, y0 + 250, dx, dy, Color.DarkRed);

            winSound.loadSound(MediaDir + "\\Sounds\\win.wav", DirectSound.DsDevice);
        }
コード例 #9
0
        public VideoScene(string directory, string format, float fps, int total_frames)
        {
            FPS         = fps;
            TotalFrames = total_frames;

            current_frame = 0;
            time          = 0.0f;

            frames = new TgcTexture[TotalFrames];

            for (int i = 1; i <= TotalFrames; i++)
            {
                frames[i - 1] = TgcTexture.createTexture(directory + @"\" + i.ToString("D4") + "." + format);
            }

            sprite         = new TgcSprite();
            sprite.Texture = frames[current_frame];

            Size screenSize  = GuiController.Instance.Panel3d.Size;
            Size textureSize = sprite.Texture.Size;

            sprite.Scaling = new Vector2(
                (float)screenSize.Width / textureSize.Width,
                (float)screenSize.Height / textureSize.Height);

            sprite.Position = new Vector2(
                FastMath.Max(screenSize.Width / 2 - textureSize.Width * sprite.Scaling.X / 2, 0),
                FastMath.Max(screenSize.Height / 2 - textureSize.Height * sprite.Scaling.Y / 2, 0));

            sound = new TgcStaticSound();
            sound.loadSound(directory + @"\sound.wav");

            Playing = false;
        }
コード例 #10
0
        private void crearSonido()
        {
            //Instanciar sonido del ambiente Oceano
            sonidoAmbienteOceano = new TgcStaticSound();
            string sonidoPath = Utiles.getDirSonido("Oceano.wav");

            sonidoAmbienteOceano.loadSound(sonidoPath);
        }
コード例 #11
0
        public static void Play(string soundPath)
        {
            var temp = new TgcStaticSound();

            temp.loadSound(soundPath, DirectSound.DsDevice);

            Play(temp);
        }
コード例 #12
0
 public TriggerSound(Vector3 aPosition, string path, Device device)
 {
     area          = new TgcBox();
     area.Size     = new Vector3(60, 60, 60);
     area.Position = aPosition;
     sound         = new TgcStaticSound();
     sound.loadSound(path, device);
 }
コード例 #13
0
 protected Player()
 {
     walking = new TgcStaticSound();
     walking.loadSound(SoundsManager.Instance().mediaDir + "Sounds\\walking.wav", SoundsManager.Instance().sound);
     colision = new TgcStaticSound();
     colision.loadSound(SoundsManager.Instance().mediaDir + "Sounds\\colision.wav", SoundsManager.Instance().sound);
     gameOver = new TgcStaticSound();
     gameOver.loadSound(SoundsManager.Instance().mediaDir + "Sounds\\gameover.wav", SoundsManager.Instance().sound);
 }
コード例 #14
0
 public Shark(TgcMesh mesh) : base(mesh, meshLookDir)
 {
     this.vida = 500;
     necesitaArmaParaInteractuar = true;
     agarrarEfecto = new TgcStaticSound();
     agarrarEfecto.loadSound(SoundsManager.Instance().mediaDir + "Sounds\\stab.wav", SoundsManager.Instance().sound);
     soundWin = new TgcStaticSound();
     soundWin.loadSound(SoundsManager.Instance().mediaDir + "Sounds\\win.wav", SoundsManager.Instance().sound);
 }
コード例 #15
0
 public Entity(TgcMesh mesh, TGCVector3 defaultLookDir)
 {
     if (!necesitaArmaParaInteractuar)
     {
         agarrarEfecto = new TgcStaticSound();
         agarrarEfecto.loadSound(SoundsManager.Instance().mediaDir + "Sounds\\grab.wav", SoundsManager.Instance().sound);
     }
     this.mesh           = mesh;
     this.defaultLookDir = defaultLookDir;
 }
コード例 #16
0
        public TerrainBrush(TgcTerrainEditor editor)
        {
            SoundEnabled = true;
            text         = new TgcText2D();
            text.Align   = TgcText2D.TextAlign.RIGHT;
            text.changeFont(new Font("Arial", 12, FontStyle.Bold));

            bBrush = TGCBox.fromSize(new TGCVector3(10, 100, 10));
            sound  = new TgcStaticSound();
            sound.loadSound(editor.MediaDir + "Sound\\tierra.wav", editor.DirectSound.DsDevice);
        }
コード例 #17
0
        public TerrainBrush()
        {
            SoundEnabled = true;
            text         = new TgcText2d();
            text.Align   = TgcText2d.TextAlign.RIGHT;
            text.changeFont(new System.Drawing.Font("Arial", 12, FontStyle.Bold));

            bBrush = TgcBox.fromSize(new Vector3(10, 100, 10));
            sound  = new TgcStaticSound();
            sound.loadSound(GuiController.Instance.ExamplesMediaDir + "Sound\\tierra.wav");
        }
コード例 #18
0
ファイル: Explosion.cs プロジェクト: ftobares/tp-tgc
        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();
        }
コード例 #19
0
        public EnemigoAnimacion(Vector3 cercania, Vector3 dimensionesCaja)
        {
            string pathSonido = alumnoMediaFolder + "CucarachaJugosita\\Media\\Juego felipe sonido ambiente terror.wav";

            sonidoPreSusto = new TgcStaticSound();
            sonidoPreSusto.loadSound(pathSonido);
            this.cercania    = cercania;
            animada          = false;
            activarAnimacion = false;
            //Paths para archivo XML de la malla
            pathMesh = alumnoMediaFolder + "CucarachaJugosita\\Media\\SkeletalAnimations\\Robot\\Robot-TgcSkeletalMesh.xml";

            //Path para carpeta de texturas de la malla
            mediaPath = alumnoMediaFolder + "CucarachaJugosita\\Media\\SkeletalAnimations\\Robot\\";

            //Lista de animaciones disponibles
            animationList = new string[] {
                "Parado",
                "Caminando",
                "Correr",
                "PasoDerecho",
                "PasoIzquierdo",
                "Empujar",
                "Patear",
                "Pegar",
                "Arrojar",
            };

            //Crear rutas con cada animacion
            animationsPath = new string[animationList.Length];
            for (int i = 0; i < animationList.Length; i++)
            {
                animationsPath[i] = mediaPath + animationList[i] + "-TgcSkeletalAnim.xml";
            }

            //Cargar mesh y animaciones
            TgcSkeletalLoader loader2 = new TgcSkeletalLoader();

            mesh = loader2.loadMeshAndAnimationsFromFile(pathMesh, mediaPath, animationsPath);
            //mesh.Position = new Vector3(105, 5.06f, 660);
            mesh.Scale = new Vector3(0.5f, 0.5f, 0.5f);
            //Crear esqueleto a modo Debug
            mesh.buildSkletonMesh();
            //Elegir animacion Caminando
            // mesh.BoundingBox.move(new Vector3(15,0,-170));
            //mesh.BoundingBox.scaleTranslate(mesh.BoundingBox.Position, new Vector3(4f,0.8f,4f)); // este sera el rango de vision
            bounding = new TgcBox();
            bounding = TgcBox.fromSize(mesh.Position, new Vector3(100f, 100f, 300f));
            bounding.move(new Vector3(15, 0, -170));
            box          = new TgcBox();
            box.Position = cercania;
            box.Size     = dimensionesCaja;
        }
コード例 #20
0
ファイル: Personaje.cs プロジェクト: ftobares/tp-tgc
        public void die()
        {
            // GuiController.Instance.Mp3Player.closeFile();
            // GuiController.Instance.Mp3Player.FileName = GuiController.Instance.AlumnoEjemplosMediaDir + "Kamikaze3D\\AK47\\death.mp3";
            // GuiController.Instance.Mp3Player.play(false);

            TgcStaticSound morir = new TgcStaticSound();

            morir.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "Kamikaze3D\\AK47\\death.wav");
            morir.play();

            this.dead = true;
        }
コード例 #21
0
        public VegetationPicker(TgcTerrainEditor editor)
        {
            label       = new TgcText2D();
            label.Color = Color.Yellow;
            label.Align = TgcText2D.TextAlign.LEFT;
            font        = new Font("Arial", 12, FontStyle.Bold);
            label.changeFont(font);

            Rotation     = RotationAxis.Y;
            SoundEnabled = true;
            sound        = new TgcStaticSound();
            sound.loadSound(editor.MediaDir + "Sound\\pisada arena dcha.wav", -2000, editor.DirectSound.DsDevice);
        }
コード例 #22
0
        public VegetationPicker()
        {
            label       = new TgcText2d();
            label.Color = Color.Yellow;
            label.Align = TgcText2d.TextAlign.LEFT;
            font        = new System.Drawing.Font("Arial", 12, FontStyle.Bold);
            label.changeFont(font);

            Rotation     = RotationAxis.Y;
            SoundEnabled = true;
            sound        = new TgcStaticSound();
            sound.loadSound(GuiController.Instance.ExamplesMediaDir + "Sound\\pisada arena dcha.wav", -2000);
        }
コード例 #23
0
        public override void Init()
        {
            internalCamera = Camera as FpsCamera;

            CollisionMeshes = new List <ItemModel>();

            collisionCylinder = new TgcBoundingCylinder(Camera.LookAt, 50f, 200f);
            updownRot         = Geometry.DegreeToRadian(90f) + (FastMath.PI / 10.0f);
            collisionCylinder.rotateZ(updownRot);
            collisionCylinder.setRenderColor(Color.LimeGreen);
            collisionCylinder.updateValues();

            pickUpSound.loadSound(MediaDir + "\\Sounds\\pickUpItem.wav", DirectSound.DsDevice);
        }
コード例 #24
0
        public override void Init()
        {
            vida       = 100;
            sprintTime = 0;
            tiredTime  = 0;
            running    = false;

            hitSound    = new TgcStaticSound();
            breathSound = new TgcStaticSound();
            walkSound   = new TgcStaticSound();
            runSound    = new TgcStaticSound();

            sniper = new Sniper();
            sniper.Init();
            launcher = new RocketLauncher();
            launcher.Init();

            weapon = sniper;
            weapon.muzzle.scale = weapon.scaleMuzzle;

            //Mesh auxiliar para el sonido
            TgcSceneLoader loader = new TgcSceneLoader();
            TgcScene       scene2 = loader.loadSceneFromFile(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Meshes\\svd\\svd-TgcScene.xml");

            meshAuxiliarParaSonido = scene2.Meshes[0];

            //hago que los 3dSound sigan al arma
            GuiController.Instance.DirectSound.ListenerTracking = meshAuxiliarParaSonido;
            ///////////////CONFIGURAR CAMARA PRIMERA PERSONA CUSTOM//////////////////
            //Camara en primera persona, tipo videojuego FPS
            //Solo puede haber una camara habilitada a la vez. Al habilitar la camara FPS se deshabilita la camara rotacional
            //Por default la camara FPS viene desactivada
            GuiController.Instance.RotCamera.Enable = false;
            CustomFpsCamera.Instance.Enable         = true;
            GuiController.Instance.CurrentCamera    = CustomFpsCamera.Instance;
            //Configurar posicion y hacia donde se mira
            CustomFpsCamera.Instance.setCamera(new Vector3(0, 930, 0), new Vector3(-400, 930, 0));

            prevEye = CustomFpsCamera.Instance.eye;
            //cargar sonido
            breathSound.loadSound(breathingSoundDir, HUDManager.Instance.PLAYER_VOLUME);
            hitSound.loadSound(hitSoundDir, HUDManager.Instance.PLAYER_VOLUME);
            //reproducir sonido de respawn
            playSound(walkSound, walkSoundDir, true);
            playSound(runSound, runSoundDir, true);
            runSound.stop();
            walkSound.stop();
        }
コード例 #25
0
        public Camara()
        {
            GuiController.Instance.UserVars.addVar("pisada");
            Control focusWindows = GuiController.Instance.D3dDevice.CreationParameters.FocusWindow;

            mouseCenter = focusWindows.PointToScreen(
                new Point(
                    focusWindows.Width / 2,
                    focusWindows.Height / 2)
                );
            sonidoPisada1 = new TgcStaticSound();

            sonidoPisada1.loadSound(GuiController.Instance.AlumnoEjemplosDir + "GODMODE\\Media\\Sound\\pisada1corta.wav");
            sonidoPisada2 = new TgcStaticSound();
            sonidoPisada2.loadSound(GuiController.Instance.AlumnoEjemplosDir + "GODMODE\\Media\\Sound\\pisada2corta.wav");
        }
コード例 #26
0
ファイル: Personaje.cs プロジェクト: ftobares/tp-tgc
        private void fire()
        {
            //Codigo de disparar
            Proyectil bala = new Proyectil(this);

            bala.inicializar();
            balas.Add(bala);

            //GuiController.Instance.Mp3Player.closeFile();
            // GuiController.Instance.Mp3Player.FileName = GuiController.Instance.AlumnoEjemplosMediaDir + "Kamikaze3D\\AK47\\gunshot.mp3";
            //GuiController.Instance.Mp3Player.play(false);

            TgcStaticSound sonidoTiro = new TgcStaticSound();

            sonidoTiro.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + "Kamikaze3D\\AK47\\gunshot.wav");
            sonidoTiro.play();
        }
コード例 #27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="path">La direccion sin mediaDir</param>
 /// <param name="volumen">Va entre 0(max) y -10000(min) en centenas de decibel</param>
 /// <param name="duracion"></param>
 /// <param name="repeticiones"></param>
 /// <param name="delay">Tiempo hasta que empiece el sonido</param>
 /// <param name="ID">Un nombre por si necesitas encontrar ese sonido, usar "" para no-name</param>
 public Sonido(string path, int volumen, float duracion, int repeticiones /*-1 = infinito*/, float delay, string ID /*usar "" pa indicar no ID*/)//volumen es atenuacion en hundredths of a decibel -> entre 0 y -10000 https://docs.microsoft.com/en-us/previous-versions/ms817348(v=msdn.10)
 {
     this.path    = path;
     this.volumen = volumen;
     this.sonido  = new TgcStaticSound();
     if (this.volumen > 0)
     {
         this.volumen = 0;
     }
     sonido.loadSound(VariablesGlobales.mediaDir + this.path, this.volumen, VariablesGlobales.soundDevice);
     this.ID       = ID;
     this.duracion = duracion * repeticiones;
     if (repeticiones < 0)
     {
         infinito = true;
     }
     //this.repeticiones = repeticiones;
 }
コード例 #28
0
        public override void Init()
        {
            text = new TgcText2D();

            text.Text     = "CRAFTEO";
            text.Color    = Color.White;
            text.Align    = TgcText2D.TextAlign.RIGHT;
            text.Position = new Point(300, 40);
            text.Size     = new Size(300, 100);
            text.changeFont(new Font("TimesNewRoman", 25, FontStyle.Bold));

            gui.Create(MediaDir);
            gui.InitDialog(false, false);

            CreateInterface();

            craftSound.loadSound(MediaDir + "\\Sounds\\craft.wav", DirectSound.DsDevice);
        }
コード例 #29
0
        private void loadSound(string filePath)
        {
            if (currentFile == null || currentFile != filePath)
            {
                currentFile = filePath;

                //Borrar sonido anterior
                if (sound != null)
                {
                    sound.dispose();
                    sound = null;
                }

                //Cargar sonido
                sound = new TgcStaticSound();
                sound.loadSound(currentFile);
            }
        }
コード例 #30
0
        /// <summary>
        /// Método que carga los sonidos inicialmente.
        /// </summary>
        public static void Cargar()
        {
            Mp3Player          = GuiController.Instance.Mp3Player;
            Mp3Player.FileName = Utiles.SonidosDir("Hans Zimmer - Drink up me hearties yo ho.mp3");

            RuidoAmbienteOceano = new TgcStaticSound();
            RuidoAmbienteOceano.loadSound(Utiles.SonidosDir("Oceano.wav"));

            RuidoAmbienteSubmarino = new TgcStaticSound();
            RuidoAmbienteSubmarino.loadSound(Utiles.SonidosDir("Submarino.wav"));

            SonidoTrueno1 = new TgcStaticSound();
            SonidoTrueno1.loadSound(Utiles.SonidosDir("Trueno01.wav"));
            SonidoTrueno2 = new TgcStaticSound();
            SonidoTrueno2.loadSound(Utiles.SonidosDir("Trueno02.wav"));

            SuperMarioCoin = new TgcStaticSound();
            SuperMarioCoin.loadSound(Utiles.SonidosDir("SuperMarioBros - Coin.wav"));
        }
コード例 #31
0
ファイル: TestPelota.cs プロジェクト: rejurime/socketes-tgc
        public override void Init()
        {
            //BoundingBox
            //GuiController.Instance.Modifiers.addBoolean("BoundingBox", "BoundingBox", false);

            //Luz
            //GuiController.Instance.Modifiers.addFloat("lightIntensity", 0, 100, 50);
            //GuiController.Instance.Modifiers.addFloat("lightAttenuation", 0.1f, 2, 0.20f);

            //TODO Arreglar para despues :)
            Dictionary<string, TgcStaticSound> sonidos = new Dictionary<string, TgcStaticSound>();
            TgcStaticSound sonido = new TgcStaticSound();
            sonido.loadSound(MediaDir + "Audio\\pelota-tiro.wav", DirectSound.DsDevice);
            sonidos.Add("pelota-tiro", sonido);

            //this.partido = PartidoFactory.Instance.CrearPartido(pathRecursos, Input, sonidos, GuiController.Instance.ThirdPersonCamera);

            //Configurar camara en Tercer Persona
            //GuiController.Instance.ThirdPersonCamera.Enable = true;
            //GuiController.Instance.ThirdPersonCamera.setCamera(this.partido.Pelota.Position, 200, -250);
        }
コード例 #32
0
ファイル: TestCamara.cs プロジェクト: rejurime/socketes-tgc
        /// <summary>
        /// Método que se llama una sola vez,  al principio cuando se ejecuta el ejemplo.
        /// Escribir aquí todo el código de inicialización: cargar modelos, texturas, modifiers, uservars, etc.
        /// Borrar todo lo que no haga falta
        /// </summary>
        public override void Init()
        {
            //TODO Arreglar para despues :)
            Dictionary<string, TgcStaticSound> sonidos = new Dictionary<string, TgcStaticSound>();
            TgcStaticSound sonido = new TgcStaticSound();
            sonido.loadSound(MediaDir + "Audio\\pelota-tiro.wav", DirectSound.DsDevice);
            sonidos.Add("pelota-tiro", sonido);

            //FIXME arreglar para que el partido no tenga que recibir la camara.
            //this.partido = PartidoFactory.Instance.CrearPartido(pathRecursos, Input, sonidos, this.camaraInterna);

            //BoundingBox
            //GuiController.Instance.Modifiers.addBoolean("BoundingBox", "BoundingBox", false);

            //Luz
            //GuiController.Instance.Modifiers.addFloat("lightIntensity", 0, 100, 50);
            //GuiController.Instance.Modifiers.addFloat("lightAttenuation", 0.1f, 2, 0.20f);

            //Camara en 1ra persona
            this.camaraInterna = new TgcFpsCamera(new Vector3(260f, 170f, 390f), 400f, 300f, Input);
            Camara = this.camaraInterna;
            //GuiController.Instance.FpsCamera.setCamera(new Vector3(0, 10, -20), new Vector3(0, 0, 0));
        }
コード例 #33
0
        /// <summary>
        /// Método que se llama una sola vez,  al principio cuando se ejecuta el ejemplo.
        /// Escribir aquí todo el código de inicialización: cargar modelos, texturas, modifiers, uservars, etc.
        /// Borrar todo lo que no haga falta
        /// </summary>
        public override void Init()
        {
            //Musica
            //GuiController.Instance.Modifiers.addBoolean("Musica", "Música", true);

            //BoundingBox
            //GuiController.Instance.Modifiers.addBoolean("BoundingBox", "BoundingBox", false);

            //Inteligencia Artificial
            //GuiController.Instance.Modifiers.addBoolean("IA", "IA", true);

            //Un boton para reiniciar las posiciones
            //GuiController.Instance.Modifiers.addButton("ReiniciarPosiciones", "Reiniciar Posiciones", new EventHandler(this.ReiniciarPosiciones_Click));

            //Luz
            //GuiController.Instance.Modifiers.addFloat("lightIntensity", 0, 100, 50);
            //GuiController.Instance.Modifiers.addFloat("lightAttenuation", 0.1f, 2, 0.20f);

            //Empiezo con un tema Random :)
            int numbreTrack = new Random().Next(Settings.Default.music.Count);
            //GuiController.Instance.Mp3Player.FileName = pathRecursos + Settings.Default.music[numbreTrack];

            //TODO Arreglar para despues :)
            Dictionary<string, TgcStaticSound> sonidos = new Dictionary<string, TgcStaticSound>();
            TgcStaticSound sonido = new TgcStaticSound();
            sonido.loadSound(MediaDir + "Audio\\pelota-tiro.wav", DirectSound.DsDevice);
            sonidos.Add("pelota-tiro", sonido);

            //Configurar camara en Tercer Persona
            camaraInterna = new TgcThirdPersonCamera();
            Camara = camaraInterna;

            this.pantallaActual = 0;

            //Creo el menu
            this.menu = new MenuInicial(MediaDir, camaraInterna, this);

            //Creo la configuracion del partido
            this.configuracionPartido = new ConfiguracionPartido(MediaDir, D3DDevice.Instance.Width, camaraInterna, this);

            //Creo el partido
            this.partido = PartidoFactory.Instance.CrearPartido(MediaDir, Input, sonidos, camaraInterna);

            drawer2D = new Drawer2D();

            //Mapa
            this.mapa = new CustomSprite();
            this.mapa.Bitmap = new CustomBitmap(MediaDir + "Texturas\\mapa.png", D3DDevice.Instance.Device);
            //this.mapa.Scaling = new Vector2(0.75f, 0.75f);
            Size textureSize = this.mapa.Bitmap.Size;
            this.mapa.Position = new Vector2((D3DDevice.Instance.Width - textureSize.Width) / 2, (D3DDevice.Instance.Height - textureSize.Height));

            this.puntoAzul = new CustomSprite();
            this.puntoAzul.Bitmap = new CustomBitmap(MediaDir + "Texturas\\radarAzul.png", D3DDevice.Instance.Device);
            this.puntoAzul.Scaling = new Vector2(0.03f, 0.03f);

            this.puntoNaranja = new CustomSprite();
            this.puntoNaranja.Bitmap = new CustomBitmap(MediaDir + "Texturas\\radarNaranja.png", D3DDevice.Instance.Device);
            this.puntoNaranja.Scaling = new Vector2(0.03f, 0.03f);

            //Color de fondo (BackgroundColor)
            D3DDevice.Instance.Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);

            //FIX que nos mando Mariano para poder bajar el Alpha en el PixelShader
            D3DDevice.Instance.Device.RenderState.ReferenceAlpha = 10;
        }