Exemple #1
0
 public static void Init()
 {
     ambientSoundLluvia = new TgcStaticSound();
     ambientSoundLluvia.loadSound(EjemploAlumno.media() + "Sonidos\\Tormenta.wav");
     GuiController.Instance.Mp3Player.FileName = EjemploAlumno.media() + "Sonidos\\Oceano.mp3";
     GuiController.Instance.Mp3Player.play(true);
 }
        public void init()
        {
            Device device = GuiController.Instance.D3dDevice;
                sphere = new TgcBoundingSphere(posicion, EXPLOSION_RADIUS);

                sound = new TgcStaticSound();
                time = 0;

                int width = GuiController.Instance.Panel3d.Width;
                int height = GuiController.Instance.Panel3d.Height;

                int cantExplosion = 20;
                float particleTime = 1f, sizeMax = 2000f, expSpeed = 1f, expSizeSpeed = 20f; ;
                float expUpdateTime = 0;

                //Creo el emisor de explosion
                emisorExplosion = new ExplosionEmitter(cantExplosion, posicion, new Vector3(expSpeed, expSpeed, expSpeed), new Vector3(0.00f, 0.00f, 0.00f), 500f, sizeMax, particleTime, Color.White, 150, 0f, expUpdateTime, GameManager.Instance.random.Next(0, 1000), expSizeSpeed, 2);
                emisorExplosion.Init();

                int cantidad = 20;
                Vector3 origen1 = posicion;
                float speed = 5f;
                float divergence = 7f;
                Vector3 velocidad = new Vector3(divergence, speed, divergence);
                Vector3 aceleracion = new Vector3(0, 0, 0);
                float min = 500f, max = 1000f, tiempoVida_Particula = 1f;
                int alpha = 150;
                float spawn = 0.01f;
                float sizeSpeed = 1000f;
                float updateTime = 0.02f;

                //Creo los emisores de humo
                emisorHumo = new SmokeEmitter(cantidad, origen1, velocidad, aceleracion, min, max, tiempoVida_Particula, Color.DarkGray, alpha, spawn, updateTime, sizeSpeed);
                emisorHumo.Init();
        }
Exemple #3
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;
        }
 public Portal()
 {
     var mesh = Game.Current.NewMesh("BallTextured");
     Add(_PartList[0] = new MeshStaticPart(mesh) { Texture = Game.Current.GetMaterial("BluePortal.png") });
     _PartList[1] = _Collider = new ObbCollider(mesh); Add(_Collider);
     var receptorMesh = Game.Current.NewMesh("BallTextured");
     Add(_PartList[2] = _Receptor = new MeshImmutableePart(receptorMesh) { Texture = Game.Current.GetMaterial("OrangePortal.png") });
     _SoundEffect = Game.Current.GetSound("Portal.wav", EffectVolume);
 }
        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");
        }
        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;
        }
        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);
        }
        public override void Init()
        {
            weaponOscilation = 0;
            FIRE_DELAY = 0;
            MAX_DELAY = 2;
            weaponSound = new TgcStaticSound();
            muzzle = new MuzzleFlash();
            muzzle.crearMuzzle();

            //Permitir matrices custom
            mesh.AutoTransformEnable = false;

            currentShader = GuiController.Instance.Shaders.TgcMeshPointLightShader;
        }
        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();
        }
 public BlackHole()
 {
     var mesh = Game.Current.NewMesh("BallTextured");
     Add(new MeshStaticPart(mesh) { Texture = Game.Current.GetMaterial("BlackHole.jpg") });
     Add(new SphereCollider(mesh));
     _SoundEffect = Game.Current.GetSound("BlackHole.wav", EffectVolume);
     Add(_StarStorm = new TranslatedParticlePart()
     {
         Translation = new Vector3(0, 0, -4),
         Animation = new AnimatedQuad()
         {
             Texture = Game.Current.GetParticle("thunders.png"),
             FrameSize = new Size(256, 256),
             Size = new Vector2(25, 25),
             FirstFrame = 0,
             CurrentFrame = 0,
             FrameRate = 15,
             TotalFrames = 16,
         }
     });
 }
        public override void init()
        {

            Microsoft.DirectX.Direct3D.Device d3dDevice = GuiController.Instance.D3dDevice;


            //Crear loader
            TgcKeyFrameLoader loader = new TgcKeyFrameLoader();

            //Crear piso
            TgcTexture pisoTexture = TgcTexture.createTexture(d3dDevice, GuiController.Instance.ExamplesMediaDir + "Texturas\\tierra.jpg");
            piso = TgcBox.fromSize(new Vector3(0, -60, 0), new Vector3(1000, 5, 1000), pisoTexture);

            String mediaDir = CommandosUI.Instance.MediaDir;
           

           //Cargar modelo con una animación Key Frame
            string pathMesh = mediaDir  + "Pez//" + "pez-TgcKeyFrameMesh.xml";
            string[] animationsPath = new string[] {
                mediaDir + "Pez//Animaciones//nadar-TgcKeyFrameAnim.xml",
                mediaDir + "Pez//Animaciones//quieto-TgcKeyFrameAnim.xml"
            };
            personaje = (TgcKeyFrameMesh)loader.loadMeshAndAnimationsFromFile(pathMesh, animationsPath);

            personaje.playAnimation("quieto");

            //Sonido

            //Cargar sonido
            sonidoChapoteo = new TgcStaticSound();
            sonidoChapoteo.loadSound(mediaDir+ "Pez//" + "Sound//WATER.WAV");

            //Posicion inicial
            personaje.Position = new Vector3(0, -45, 0);
            personaje.rotateY(Geometry.DegreeToRadian(180f));


             GuiController.Instance.Modifiers.addFloat("speed", 10, 100, 40);
            //Crear un modifier para un ComboBox con opciones
            string[] opciones = new string[] { "Teclas", "Picking"};
            GuiController.Instance.Modifiers.addInterval("Controles", opciones, 0);
            currentControl = "Teclas";

            //Configurar camara en Tercer Persona
            GuiController.Instance.ThirdPersonCamera.Enable = true;
            GuiController.Instance.ThirdPersonCamera.setCamera(personaje.Position, 30, -30);

            //Coordenadas mouse
            GuiController.Instance.UserVars.addVar("Posicion Mouse");



            //Musica :D
            GuiController.Instance.Mp3Player.FileName = mediaDir + "Pez//" + "Music//UWSDWF.mp3";
            GuiController.Instance.Mp3Player.play(true);
            reproduciendo = true;
            GuiController.Instance.Modifiers.addBoolean("Musica", "Reproducir", true);

            //Picking
            pickingRay = new TgcPickingRay();
            collisionPointMesh = TgcBox.fromSize(new Vector3(3, 1, 3), Color.Red);
           
         }
Exemple #12
0
        private void LoadSounds(string media)
        {
            sound_Zoom = new TgcStaticSound();
            sound_Zoom.loadSound(media + @"CEGA\Sound\zoom.wav", -1000);

            TgcStaticSound sound_Walk = new TgcStaticSound();
            sound_Walk.loadSound(media + @"CEGA\Sound\pl_dirt1.wav", -2000);

            sound_Disparo = new TgcStaticSound();
            sound_Disparo.loadSound(media + @"CEGA\Sound\disparo.wav", -1500);

            sound_DryFire = new TgcStaticSound();
            sound_DryFire.loadSound(media + @"CEGA\Sound\dryfire.wav", -1000);

            sound_Hit = new TgcStaticSound();
            sound_Hit.loadSound(media + @"CEGA\Sound\hit.wav", -500);

            sound_Die = new TgcStaticSound();
            sound_Die.loadSound(media + @"CEGA\Sound\die.wav", -500);

            camera.MovementSound = sound_Walk;
        }
        /// <summary>
        /// Cargar un nuevo WAV si hubo una variacion
        /// </summary>
        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);

                currentSoundText.Text = "Playing: " + new FileInfo(currentFile).Name;
            }
        }
Exemple #14
0
        public Cannon()
        {
            var bodyMesh = Game.Current.GetMesh("Cannon");
            _LoadColider = new ObbCollider()
            {
                Extents = _LoadColiderExtents,
                Color = ItemPart.DefaultPartColor,
            };
            Add(_LoadColider as ItemPart);
            Add(new MeshStaticPart(bodyMesh));
            var bodyObb = TgcObb.computeFromAABB(bodyMesh.BoundingBox);
            var bodyE = bodyObb.Extents;
            bodyObb.Extents = new Vector3(bodyE.X * _BodyObbScaleY, bodyE.Y, bodyE.Z * _BodyObbScaleY);
            Add(new HollowObbCollider(bodyObb, bodyObb.Position - bodyMesh.Position, _MinBorderScale, _MaxBorderScale));
            bodyObb.dispose();

            var baseMesh = Game.Current.GetMesh("CannonBase");
            var baseObb = TgcObb.computeFromAABB(baseMesh.BoundingBox);
            var baseE = baseObb.Extents;
            baseObb.Extents = new Vector3(baseE.X, baseE.Y * _BaseObbScaleY, baseE.Z);
            Add(_Base = new MeshUnRotatedPart(baseMesh));
            Add(_BaseCollider = new ObbTranslatedUnRotatedCollider(baseObb, _BaseObbTranslation));

            Add(_Smoke = new TranslatedParticlePart()
            {
                Translation = new Vector3(0, 33, -4),
                Sound = Game.Current.GetSound("Cannon.wav", EffectVolume),
                Animation = new AnimatedQuad()
                {
                    Texture = Game.Current.GetParticle("ExplosionGrey.png"),
                    FrameSize = new Size(146, 146),
                    Size = new Vector2(25, 25),
                    FirstFrame = 2,
                    CurrentFrame = 2,
                    FrameRate = 15,
                    TotalFrames = 47,
                }
            });
            RotationChanged += Cannon_RotationChanged;
            _ChargeSound = Game.Current.GetSound("CannonCharge.wav", 0);
        }
Exemple #15
0
 private void _Shoot()
 {
     _ChargeSound.dispose();
     _ChargeSound = Game.Current.GetSound("CannonCharge.wav", 0);
     var d = _LoadColider.Orientation[1];
     _Load.Position += d * (_LoadColiderExtents.Y + 1);
     _Load.Velocity = d * _ForceReal;
     _Load = null;
     _Smoke.Start();
 }
Exemple #16
0
 public override void LoadValues()
 {
     _ChargeSound.dispose();
     _ChargeSound = Game.Current.GetSound("CannonCharge.wav", 0);
     _Base.Rotation = _BaseRotationSaved;
     RotationTarget = _RotationTargetSaved;
     _IsRotationTarget = _IsRotationTargetSaved;
     base.LoadValues();
     OnScaleChanged();
     _Load = null;
     _Smoke.Stop();
 }
        private static Random random = new Random(); // OMG

        private static TgcStaticSound soundFor(String fileName)
        {
            TgcStaticSound sound = new TgcStaticSound();
            sound.loadSound(CommandosUI.Instance.MediaDir + "Sounds\\" + fileName);
            return sound;
        }
        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;
        }
Exemple #19
0
 public TgcStaticSound GetSound(String soundFile, int volume)
 {
     var sound = new TgcStaticSound();
     sound.loadSound(_SoundFolder + soundFile, volume);
     return sound;
 }
Exemple #20
0
 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);
     }
 }
Exemple #21
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();
         //}
     }
 }
Exemple #23
0
        /// <summary>Código de inicialización: cargar modelos, texturas, modifiers, uservars, etc.</summary>
        public override void init()
        {
            var d3dDevice = Gui.I.D3dDevice;

            this.terrain = new Terrain.Terrain(SCALE_XZ, SCALE_Y);

            var tankY = this.terrain.heightmapData[64, 64] * SCALE_Y;
            this.tank = new Tank.TankPlayer(new Vector3(0, tankY + 15, 0), this.terrain, Path.Tank);

            var rand = new Randomizer((int)-this.terrain.heightmapSizeScaled/2 + 500, (int)this.terrain.heightmapSizeScaled/2 - 500);
            this.tankEnemy = new Tank.TankEnemy(new Vector3(rand.getNext(), tankY + 15, rand.getNext()), this.terrain);

            this.tank.enemy = this.tankEnemy;
            this.tankEnemy.enemy = this.tank;

            Gui.I.Modifiers.addFloat("Cam Velocity", 0f, 1000f, 500f);
            Gui.I.Modifiers.addFloat("rotationVelocity", 0f, 1000f, 100f);
            Gui.I.Modifiers.addBoolean("ShowBoundingBox", "Show bounding box", false);
            object[] values = {"Third Person","First Person(Free)" };
            Gui.I.Modifiers.addInterval("Camera", values, 0);

            UserVars.addMany(
                "posX",
                "posY",
                "posZ",
                "viewX",
                "viewY",
                "viewZ",
                "destX",
                "destY",
                "destZ",
                "totalSpeed",
                "direction",
                "enemyColliding",
                "enemyAvoiding",
                "enemyTA"
            );

            //Aumentar distancia del far plane
            d3dDevice.Transform.Projection = Matrix.PerspectiveFovLH(Geometry.DegreeToRadian(45.0f),
                (float)d3dDevice.CreationParameters.FocusWindow.Width / d3dDevice.CreationParameters.FocusWindow.Height, 1f, 30000f);
            this.setUpCamera();

            //Carga del sonido ambiente
            this.ambientSound = new TgcStaticSound();
            this.ambientSound.loadSound(Shared.MediaFolder + @"Sound\ambient.wav");
            this.ambientSound.play(true);
        }
Exemple #24
0
 public Sonido(string _path)
 {
     this.sonido = new TgcStaticSound();
     this.sonido.loadSound(_path,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);
 }
Exemple #26
0
 public ColisionesAdmin()
 {
     sound_Explosion = new TgcStaticSound();
     sound_Explosion.loadSound(GuiController.Instance.AlumnoEjemplosMediaDir + @"CEGA\Sound\explosion.wav", -500);
 }
        /// <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()
        {
            //GuiController.Instance: acceso principal a todas las herramientas del Framework

            //Device de DirectX para crear primitivas
            d3dDevice = GuiController.Instance.D3dDevice;

            rand = new Random();

            //Carpeta de archivos Media del alumno
            alumnoMediaFolder = GuiController.Instance.AlumnoEjemplosMediaDir;

            effect = TgcShaders.loadEffect(alumnoMediaFolder + "Shaders\\viento.fx");

            Control focusWindows = GuiController.Instance.D3dDevice.CreationParameters.FocusWindow;
            mouseCenter = focusWindows.PointToScreen(
                new Point(
                    focusWindows.Width / 2,
                    focusWindows.Height / 2)
                    );

            inicializarTerreno();

            pathMusica = GuiController.Instance.AlumnoEjemplosMediaDir + "Sonidos\\Stayin_alive.mp3";
            GuiController.Instance.Mp3Player.closeFile();
            GuiController.Instance.Mp3Player.FileName = pathMusica;

            player = GuiController.Instance.Mp3Player;

            //player.play(true);

            //Crear Sprite
            mira = new TgcSprite();
            mira.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\mira.png");
            miraActivada = false;
            mira_zoom = new TgcSprite();
            mira_zoom.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\mira_zoom3.png");

            arma = new TgcSprite();
            arma.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\arma.png");

            fuegoArma = new TgcAnimatedSprite(
                GuiController.Instance.ExamplesMediaDir + "\\Texturas\\Sprites\\Explosion.png", //Textura de 256x256
                new Size(64, 64), //Tamaño de un frame (64x64px en este caso)
                16, //Cantidad de frames, (son 16 de 64x64px)
                10 //Velocidad de animacion, en cuadros x segundo
                );

            //Sonidos
            disparo = new TgcStaticSound();
            disparo.loadSound(alumnoMediaFolder + "\\Sonidos\\disparo.wav");

            headshot = new TgcStaticSound();
            headshot.loadSound(alumnoMediaFolder + "\\Sonidos\\Headshot.wav");

            golpe = new TgcStaticSound();
            golpe.loadSound(alumnoMediaFolder + "\\Sonidos\\punch.wav");

            explosion = new TgcStaticSound();
            explosion.loadSound(alumnoMediaFolder + "\\Sonidos\\explosion.wav");

            muerte = new TgcStaticSound();
            muerte.loadSound(alumnoMediaFolder + "\\Sonidos\\gameover.wav");

            ganador = new TgcStaticSound();
            ganador.loadSound(alumnoMediaFolder + "\\Sonidos\\ganador.wav");

            sorpresa = new TgcStaticSound();
            sorpresa.loadSound(alumnoMediaFolder + "\\Sonidos\\sorpresa.wav");

            //Ubicarlo centrado en la pantalla
            screenSize = GuiController.Instance.Panel3d.Size;
            Size textureSize = mira.Texture.Size;
            mira.Scaling = new Vector2(0.6f, 0.6f);
            mira.Position = new Vector2(FastMath.Max(screenSize.Width / 2 - (textureSize.Width * 0.6f) / 2, 0), FastMath.Max(screenSize.Height / 2 - (textureSize.Height * 0.6f) / 2, 0));

            mira_zoom.Scaling = new Vector2((float)screenSize.Width / mira_zoom.Texture.Size.Width, (float)screenSize.Height / mira_zoom.Texture.Size.Height);
            mira_zoom.Position = new Vector2(0, 0);

            Size armaSize = arma.Texture.Size;
            float escalaAncho = (screenSize.Width / 2f) / armaSize.Width;

            arma.Scaling = new Vector2(escalaAncho, escalaAncho);
            arma.Position = new Vector2(screenSize.Width - (armaSize.Width * escalaAncho), screenSize.Height - (armaSize.Height * escalaAncho));

            posicionArmaDisparo = new Vector2(arma.Position.X + 5f, arma.Position.Y + 5f);
            posicionArmaOriginal = arma.Position;

            fuegoArma.Position = arma.Position + new Vector2(22f,28f);

            inicializarArboles();
            inicializarPasto();
            inicializarPiedras();

            totales = new List<TgcMesh>();
            totales.AddRange(arboles);
            totales.AddRange(pasto);
            totales.AddRange(piedras);

            qt = new Quadtree();
            qt.create(totales, bbSkyBox);
            qt.createDebugQuadtreeMeshes();

            //Crear texto vida, básico
            vida = new TgcText2d();
            vida.Text = "100";
            vida.Color = Color.White;
            vida.Size = new Size(300, 100);
            vida.changeFont(new System.Drawing.Font("BankGothic Md BT", 25, FontStyle.Bold));
            vida.Position = new Point(-60, 0);

            barraVida = new TgcSprite();
            barraVida.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\barra_vida.png");
            barraVida.Position = new Vector2((float)vida.Position.X + 175f, (float)vida.Position.Y);
            barraVida.Scaling = new Vector2(0.3f, 0.3f);

            textoPuntaje = new TgcText2d();
            textoPuntaje.Text = "Puntos: 0";
            textoPuntaje.Color = Color.White;
            textoPuntaje.Size = new Size(300, 100);
            textoPuntaje.changeFont(new System.Drawing.Font("BankGothic Md BT", 25, FontStyle.Bold));
            textoPuntaje.Position = new Point(screenSize.Width - 300, 0);

            TgcSceneLoader loaderLogo = new TgcSceneLoader();
            logoTgc = loaderLogo.loadSceneFromFile(GuiController.Instance.ExamplesMediaDir + "ModelosTgc\\LogoTGC\\LogoTGC-TgcScene.xml").Meshes[0];
            logoTgc.move(new Vector3(0f, 1900f, 0f));
            logoTgc.Scale = new Vector3(14f, 14f, 14f);

            //Cargar Shader de PhongShading
            logoTgc.Effect = GuiController.Instance.Shaders.TgcMeshPhongShader;
            logoTgc.Technique = GuiController.Instance.Shaders.getTgcMeshTechnique(logoTgc.RenderType);
            //Cargar variables shader
            logoTgc.Effect.SetValue("ambientColor", ColorValue.FromColor(Color.Gray));
            logoTgc.Effect.SetValue("diffuseColor", ColorValue.FromColor(Color.LightBlue));
            logoTgc.Effect.SetValue("specularColor", ColorValue.FromColor(Color.White));
            logoTgc.Effect.SetValue("specularExp", 20f);
            logoTgc.Effect.SetValue("lightPosition", lightPos);
            reproducirSorpresa = false;

            //////VARIABLES DE FRUSTUM

            aspectRatio = (float)GuiController.Instance.Panel3d.Width / GuiController.Instance.Panel3d.Height;

            ruedita = 0f;

            //Inicializo angulo de FOV
            anguloFov = FastMath.ToRad(45.0f);

            GuiController.Instance.D3dDevice.Transform.Projection = Matrix.PerspectiveFovLH(anguloFov, aspectRatio, 1f, 50000f);

            ///////////////USER VARS//////////////////
            /*
            //Crear una UserVar
            GuiController.Instance.UserVars.addVar("variablePrueba");

            //Cargar valor en UserVar
            GuiController.Instance.UserVars.setValue("variablePrueba", 5451);
            */

            ///////////////MODIFIERS//////////////////

               /*
            //Crear un modifier para un valor FLOAT
            GuiController.Instance.Modifiers.addFloat("valorFloat", -50f, 200f, 0f);

            //Crear un modifier para un ComboBox con opciones
            string[] opciones = new string[] { "opcion1", "opcion2", "opcion3" };
            GuiController.Instance.Modifiers.addInterval("valorIntervalo", opciones, 0);

            //Crear un modifier para modificar un vértice
            GuiController.Instance.Modifiers.addVertex3f("valorVertice", new Vector3(-100, -100, -100), new Vector3(50, 50, 50), new Vector3(0, 0, 0));
            */

            ///////////////CONFIGURAR CAMARA ROTACIONAL//////////////////
            //Es la camara que viene por default, asi que no hace falta hacerlo siempre
            //GuiController.Instance.RotCamera.Enable = true;
            //Configurar centro al que se mira y distancia desde la que se mira
            //GuiController.Instance.RotCamera.setCamera(new Vector3(0, 0, 0), 300);
            Vector3 posicion = new Vector3(0f, 150f, 0f);
            /*GuiController.Instance.FpsCamera.Enable = true;
            GuiController.Instance.FpsCamera.setCamera(new Vector3(0,120,0), new Vector3(1, 0, 1));
            //GuiController.Instance.FpsCamera.LookAt(new Vector3(0,120,0));
            GuiController.Instance.FpsCamera.JumpSpeed = 0;
            GuiController.Instance.FpsCamera.MovementSpeed *= 10;*/

            GuiController.Instance.FpsCamera.Enable = false;
            GuiController.Instance.RotCamera.Enable = false;

            camaraQ3 = new Q3FpsCamera();
            camaraQ3.setCamera(posicion, posicion + new Vector3(1.0f, 0.0f, 0.0f));
            camaraQ3.RotationSpeed = velocidadAngular;
            camaraQ3.MovementSpeed = velocidadMov;
            camaraQ3.LockCam = false;

            ultimaPosCamara = camaraQ3.getPosition();
            Vector3 posBound = new Vector3(camaraQ3.getPosition().X, camaraQ3.getPosition().Y + 30, camaraQ3.getPosition().Z);
            boundingCamara = new TgcBoundingBox();
            boundingCamScale = new Vector3(1f, 1f, 1f);
            boundingCamara.scaleTranslate(posBound, boundingCamScale);

            personaje = TgcBox.fromSize(new Vector3(30f, 60f, 30f), Color.Red);
            personaje.Position = camaraQ3.getPosition();
            personaje.move(new Vector3(0f, -30f, 0f));

            //ENEMIGOS
            instanciasEnemigos = new List<Enemigo>();
            //El ultimo parametro es el radio
            inicializarEnemigos(4, 4, instanciasEnemigos, 3.4f, 200.0f);

            crearEsferaExplosion();
            inicializarBarriles();

            //Para disparo
            col = new Vector3(0f, 0f, 0f);
            huboDisparo = false;
            disparoBarril = false;
            unaBala = new Bala();
            puntoDisparo = TgcBox.fromSize(new Vector3(10f, 10f, 10f), Color.Red);

            #region menu
            //Defino el estado inicial como menu
            estadoJuego = estado.menu;

            //Sprites para menu
            fondoMenu = new TgcSprite();
            fondoMenu.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\fondo_menu.jpg");

            titulo = new TgcSprite();
            titulo.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\titulo.png");
            titulo.Scaling = new Vector2(0.5f, 0.5f);
            titulo.Position = new Vector2((screenSize.Width / 2) - titulo.Texture.Width / 4, (titulo.Texture.Height / 2)-50f);

            instrucciones = new TgcSprite();
            instrucciones.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\instrucciones.png");
            instrucciones.Scaling = new Vector2(0.4f, 0.5f);
            instrucciones.Position = new Vector2((screenSize.Width / 2) - (instrucciones.Texture.Width*0.4f) / 2, (instrucciones.Texture.Height / 2) - instrucciones.Texture.Height / 2);

            creditos = new TgcSprite();
            creditos.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\creditos.png");
            creditos.Scaling = new Vector2(0.5f, 0.5f);
            creditos.Position = new Vector2((screenSize.Width / 2) - creditos.Texture.Width / 4, (creditos.Texture.Height / 2) - creditos.Texture.Height / 2);

            botonJugar = new TgcSprite();
            botonJugar.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\boton_jugar.png");
            botonJugar.Scaling = new Vector2(0.5f, 0.5f);
            sizeJugar = botonJugar.Texture.Size;
               // sizeJugar.Width = sizeJugar.Width / 2;
            botonJugar.Position = new Vector2((screenSize.Width / 2)-sizeJugar.Width/4, (screenSize.Height / 2)-sizeJugar.Height/4);

            botonInstrucciones = new TgcSprite();
            botonInstrucciones.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\boton_instrucciones.png");
            botonInstrucciones.Scaling = new Vector2(0.5f, 0.5f);
            sizeInstrucciones = botonInstrucciones.Texture.Size;
            //sizeInstrucciones.Width = sizeInstrucciones.Width / 2;
            botonInstrucciones.Position = new Vector2((screenSize.Width / 2) - sizeInstrucciones.Width / 4, (screenSize.Height / 2) - sizeInstrucciones.Height / 4 + 85f);

            botonCreditos = new TgcSprite();
            botonCreditos.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\boton_creditos.png");
            botonCreditos.Scaling = new Vector2(0.5f, 0.5f);
            sizeCreditos = botonCreditos.Texture.Size;
            //sizeCreditos.Width = sizeCreditos.Width / 2;
            botonCreditos.Position = new Vector2((screenSize.Width / 2) - sizeCreditos.Width / 4, (screenSize.Height / 2) - sizeCreditos.Height / 4 + sizeInstrucciones.Height + 50f);

            textoPerdiste = new TgcText2d();
            textoPerdiste.Text = "Game over";
            textoPerdiste.Align = TgcText2d.TextAlign.CENTER;
            textoPerdiste.Color = Color.Black;
            textoPerdiste.Size = new Size(600, 100);
            textoPerdiste.Position = new Point((screenSize.Width / 2) - textoPerdiste.Size.Width / 2, (screenSize.Height / 2) - textoPerdiste.Size.Height / 2);
            textoPerdiste.changeFont(new System.Drawing.Font("BankGothic Md BT", 50, FontStyle.Bold));

            textoGanaste = new TgcText2d();
            textoGanaste.Text = "Ganaste!";
            textoGanaste.Align = TgcText2d.TextAlign.CENTER;
            textoGanaste.Color = Color.Black;
            textoGanaste.Size = new Size(600, 100);
            textoGanaste.Position = new Point((screenSize.Width / 2) - textoGanaste.Size.Width / 2, (screenSize.Height / 2) - textoGanaste.Size.Height / 2);
            textoGanaste.changeFont(new System.Drawing.Font("BankGothic Md BT", 50, FontStyle.Bold));

            textoPuntajeFinal = new TgcText2d();
            textoPuntajeFinal.Color = Color.Black;
            textoPuntajeFinal.changeFont(new System.Drawing.Font("BankGothic Md BT", 25, FontStyle.Bold));
            textoPuntajeFinal.Size = new Size(800, 100);
            textoPuntajeFinal.Position = new Point((screenSize.Width / 2) - textoPuntajeFinal.Size.Width / 2, (screenSize.Height / 2) - textoPuntajeFinal.Size.Height/2 + textoGanaste.Size.Height);

            textoPuntajeRecord = new TgcText2d();
            textoPuntajeRecord.Color = Color.Black;
            textoPuntajeRecord.Size = new Size(400, 60);
            textoPuntajeRecord.changeFont(new System.Drawing.Font("BankGothic Md BT", 15, FontStyle.Bold));
            textoPuntajeRecord.Position = new Point((screenSize.Width - textoPuntajeRecord.Size.Width),(screenSize.Height-textoPuntajeRecord.Size.Height/2));
            puntajeRecord = Int32.Parse(System.IO.File.ReadAllText(alumnoMediaFolder + "\\record.txt"));
            textoPuntajeRecord.Text = "Tu puntaje record es: " + puntajeRecord.ToString();

            primeraVez = true;
            #endregion menu
        }
Exemple #28
0
        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);
            }
        }